public CreatePhysicalPortCommand(NbiPort nbiPort, String defaultTopologyName) {
   setNmsPortId(nbiPort.getNmsPortId());
   setNocLabel(nbiPort.getSuggestedNocLabel());
   setBodPortId(nbiPort.getNmsNeId());
   this.allowedVlan = nbiPort.getVlan().map(Vlan::toRangeString).orElse("");
   this.topologyName = defaultTopologyName;
 }
    private void validateEnniPort(NbiPort nbiPort, String bodTopologyName, BindingResult result) {
      nbiPort
          .getVlan()
          .ifPresent(
              nbiVlan -> {
                if (getSVlan() != null) {
                  if (!nbiVlan.contains(getSVlan())) {
                    result.rejectValue(
                        "sVlan",
                        "validation.physicalport.invalid.svlan",
                        new Object[] {nbiVlan.toRangeString()},
                        "S-VLAN must be enclosed in the range {0}");
                  }
                }

                if (StringUtils.isBlank(getAllowedVlan())) {
                  result.rejectValue("allowedVlan", "validation.not.empty");
                } else {
                  Vlan allowedVlan = Vlan.parse(getAllowedVlan());

                  Vlan downstreamAllowedVlan = getSVlan() == null ? nbiVlan : Vlan.any();
                  if (!downstreamAllowedVlan.enclosesAll(allowedVlan)) {
                    result.rejectValue(
                        "allowedVlan",
                        "validation.physicalport.invalid.vlan",
                        new Object[] {downstreamAllowedVlan.toRangeString()},
                        "VLAN must be enclosed in the range {0}");
                  }
                }
              });

      if (StringUtils.isBlank(getTopologyName())) {
        result.rejectValue("topologyName", "validation.not.empty");
      } else if (Objects.equals(bodTopologyName, getTopologyName())) {
        if (getInboundPeer() == null || !matches(NsiHelper.NURN_PATTERN_REGEXP, getInboundPeer())) {
          result.rejectValue(
              "inboundPeer",
              "nl.surfnet.bod.domain.urn.message",
              new String[] {NsiHelper.NURN_PATTERN_REGEXP},
              "Did not match pattern");
        }
        if (getInboundPeer() == null
            || !matches(NsiHelper.NURN_PATTERN_REGEXP, getOutboundPeer())) {
          result.rejectValue(
              "outboundPeer",
              "nl.surfnet.bod.domain.urn.message",
              new String[] {NsiHelper.NURN_PATTERN_REGEXP},
              "Did not match pattern");
        }
      }
    }