- private List<NodeInterface> createInterface(OtnServicePathInput input) throws OpenRoadmInterfaceException {
- List<NodeInterface> nodeInterfaces = new ArrayList<>();
- if (input.getServiceRate().equals("1G")) {
- for (Nodes node: input.getNodes()) {
- //check if the node is mounted or not?
- List<String> createdEthInterfaces = new ArrayList<>();
- List<String> createdOduInterfaces = new ArrayList<>();
- createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth1GInterface(node.getNodeId(),
- node.getClientTp()));
- LOG.info("created ethernet interface");
- createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
- node.getClientTp(), input.getServiceName(),"07", false, input.getTribPortNumber(),
- input.getTribSlot())); //suppporting interface?, payload ?
- LOG.info("Created odu interface client side");
- createdOduInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
- node.getNetworkTp(), input.getServiceName(),"07", true, input.getTribPortNumber(),
- input.getTribSlot()));
- LOG.info("created odu inteface network side");
-
- //implement cross connect
- Optional<String> connectionNameOpt = postCrossConnect(createdOduInterfaces, node);
- List<String> createdConnections = new ArrayList<>();
+ private String getConnectionNumber(Nodes node, String networkTp, String oduType) {
+ List<String> list1 = new ArrayList<>();
+ List<String> list2 = new ArrayList<>(Arrays.asList("x"));
+ if (node.getClientTp() != null) {
+ list1.addAll(Arrays.asList(node.getClientTp(), oduType));
+ list2.addAll(Arrays.asList(networkTp, oduType));
+ } else if (node.getNetwork2Tp() != null) {
+ list1.addAll(Arrays.asList(networkTp, oduType));
+ list2.addAll(Arrays.asList(node.getNetwork2Tp(), oduType));
+ } else {
+ return "";
+ }
+ list1.addAll(list2);
+ return String.join("-", list1);
+ }
+
+ private Optional<String> postCrossConnect(List<String> createdOduInterfaces, Nodes node)
+ throws OpenRoadmInterfaceException {
+ return this.crossConnect.postOtnCrossConnect(createdOduInterfaces, node);
+ }
+
+ private void createLowOrderInterfaces(OtnServicePathInput input, List<NodeInterface> nodeInterfaces,
+ CopyOnWriteArrayList<LinkTp> linkTpList) throws OpenRoadmInterfaceException {
+ for (Nodes node : input.getNodes()) {
+ AEndApiInfo apiInfoA = null;
+ ZEndApiInfo apiInfoZ = null;
+ if (input.getAEndApiInfo() != null && input.getAEndApiInfo().getNodeId().contains(node.getNodeId())) {
+ apiInfoA = input.getAEndApiInfo();
+ }
+ if (input.getZEndApiInfo() != null && input.getZEndApiInfo().getNodeId().contains(node.getNodeId())) {
+ apiInfoZ = input.getZEndApiInfo();
+ }
+ // check if the node is mounted or not?
+ Set<String> createdEthInterfaces = new HashSet<>();
+ Set<String> createdOduInterfaces = new HashSet<>();
+ switch (input.getServiceRate().intValue()) {
+ case 1:
+ LOG.info("Input service is 1G");
+ if (node.getClientTp() != null) {
+ createdEthInterfaces.add(
+ openRoadmInterfaceFactory.createOpenRoadmEth1GInterface(node.getNodeId(),
+ node.getClientTp()));
+ createdOduInterfaces.add(
+ // suppporting interface?, payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getClientTp(),
+ input.getServiceName(), false, input.getTribPortNumber(), input.getTribSlot(), apiInfoA,
+ apiInfoZ, PT_07));
+ }
+ createdOduInterfaces.add(
+ openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getNetworkTp(),
+ input.getServiceName(), true, input.getTribPortNumber(), input.getTribSlot(), null, null,
+ null));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ if (node.getNetwork2Tp() != null) {
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
+ node.getNetwork2Tp(), input.getServiceName(), true, input.getTribPortNumber(),
+ input.getTribSlot(), null, null, null));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ }
+ break;
+ case 10:
+ LOG.info("Input service is 10G");
+ if (node.getClientTp() != null) {
+ createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth10GInterface(
+ node.getNodeId(), node.getClientTp()));
+ createdOduInterfaces.add(
+ // suppporting interface?, payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
+ node.getClientTp(), false, input.getTribPortNumber(),
+ input.getTribSlot(), apiInfoA, apiInfoZ, PT_03));
+ }
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(), node.getNetworkTp(),
+ true, input.getTribPortNumber(), input.getTribSlot(), null,
+ null, null));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ if (node.getNetwork2Tp() != null) {
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
+ node.getNetwork2Tp(), true, input.getTribPortNumber(),
+ input.getTribSlot(), null, null, null));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ }
+ break;
+ case 100:
+ LOG.info("Input service is 100G");
+ // Take the first and last value in the list of OpucnTribSlot (assuming SH would provide
+ // min and max value only, size two)
+ OpucnTribSlotDef minOpucnTs = input.getOpucnTribSlots().stream()
+ .min((ts1, ts2) -> ts1.getValue().compareTo(ts2.getValue())).get();
+ OpucnTribSlotDef maxOpucnTs = input.getOpucnTribSlots().stream()
+ .max((ts1, ts2) -> ts1.getValue().compareTo(ts2.getValue())).get();
+ if (node.getClientTp() != null) {
+ createdEthInterfaces.add(openRoadmInterfaceFactory.createOpenRoadmEth100GInterface(
+ node.getNodeId(), node.getClientTp()));
+ // OPUCn trib information is optional when creating ODU4 ethernet (client) interface
+ createdOduInterfaces.add(
+ openRoadmInterfaceFactory.createOpenRoadmOtnOdu4LoInterface(node.getNodeId(),
+ node.getClientTp(), input.getServiceName(), PT_07, false, minOpucnTs,
+ maxOpucnTs));
+ }
+ // Here payload-type is optional and is not used for interface creation (especially for network)
+ createdOduInterfaces.add(
+ openRoadmInterfaceFactory.createOpenRoadmOtnOdu4LoInterface(node.getNodeId(),
+ node.getNetworkTp(), input.getServiceName(), PT_07, true, minOpucnTs,
+ maxOpucnTs));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ // Here payload-type is optional and is not used for service creation
+ // This is needed if there is an intermediate node
+ if (node.getNetwork2Tp() != null) {
+ createdOduInterfaces.add(
+ openRoadmInterfaceFactory.createOpenRoadmOtnOdu4LoInterface(node.getNodeId(),
+ node.getNetwork2Tp(), input.getServiceName(), PT_07, true, minOpucnTs,
+ maxOpucnTs));
+ linkTpList.add(
+ new LinkTpBuilder().setNodeId(node.getNodeId()).setTpId(node.getNetworkTp()).build());
+ }
+ break;
+ default:
+ LOG.error("service rate {} not managed yet", input.getServiceRate());
+ return;
+ }
+
+ // implement cross connect
+ Set<String> createdConnections = new HashSet<>();
+ if (!createdOduInterfaces.isEmpty()) {
+ Optional<String> connectionNameOpt = postCrossConnect(new ArrayList<>(createdOduInterfaces), node);