- if (input.getServiceRate().equals("1G")) {
- for (Nodes node: input.getNodes()) {
- LOG.info("Input service is 1G");
- //check if the node is mounted or not?
- List<String> createdConnections = new ArrayList<>();
- List<String> createdEthInterfaces = new ArrayList<>();
- List<String> createdOduInterfaces = new ArrayList<>();
- createdEthInterfaces.add(
- openRoadmInterfaceFactory.createOpenRoadmEth1GInterface(node.getNodeId(), node.getClientTp()));
- LOG.debug("created ethernet interface {}",createdEthInterfaces.get(0));
- createdOduInterfaces.add(
- //suppporting interface?, payload ?
- openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getClientTp(),
- input.getServiceName(), "07", false, input.getTribPortNumber(), input.getTribSlot()));
- LOG.debug("Created odu interface client side {}",createdOduInterfaces.get(0));
- createdOduInterfaces.add(
- openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getNetworkTp(),
- input.getServiceName(), "07", true, input.getTribPortNumber(), input.getTribSlot()));
- LOG.debug("created odu inteface network side {} {}",createdOduInterfaces.get(0),createdOduInterfaces.get(1));
-
- //implement cross connect
+ if (input.getServiceRate() == null
+ || !(input.getServiceRate().intValue() == 1 || input.getServiceRate().intValue() == 10
+ || input.getServiceRate().intValue() == 100)) {
+ LOG.error("Service rate {} not managed yet", input.getServiceRate());
+ } else {
+ createLowOrderInterfaces(input, nodeInterfaces);
+ }
+ return nodeInterfaces;
+ }
+
+ 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)
+ throws OpenRoadmInterfaceException {
+ for (Nodes node : input.getNodes()) {
+ // check if the node is mounted or not?
+ List<String> createdEthInterfaces = new ArrayList<>();
+ List<String> createdOduInterfaces = new ArrayList<>();
+ 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(), PT_07, false, input.getTribPortNumber(), input.getTribSlot()));
+ }
+ createdOduInterfaces.add(
+ openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(), node.getNetworkTp(),
+ input.getServiceName(), PT_07, true, input.getTribPortNumber(), input.getTribSlot()));
+ if (node.getNetwork2Tp() != null) {
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu0Interface(node.getNodeId(),
+ node.getNetwork2Tp(), input.getServiceName(), PT_07, true, input.getTribPortNumber(),
+ input.getTribSlot()));
+ }
+ 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(), input.getServiceName(), PT_03, false, input.getTribPortNumber(),
+ input.getTribSlot()));
+ }
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(), node.getNetworkTp(),
+ input.getServiceName(), PT_03, true, input.getTribPortNumber(), input.getTribSlot()));
+ if (node.getNetwork2Tp() != null) {
+ createdOduInterfaces.add(
+ // supporting interface? payload ?
+ openRoadmInterfaceFactory.createOpenRoadmOdu2eInterface(node.getNodeId(),
+ node.getNetwork2Tp(), input.getServiceName(), PT_03, true, input.getTribPortNumber(),
+ input.getTribSlot()));
+ }
+ 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 = OpucnTribSlotDef.getDefaultInstance(
+ input.getOpucnTribSlots().get(0).getValue());
+ OpucnTribSlotDef maxOpucnTs = OpucnTribSlotDef.getDefaultInstance(
+ input.getOpucnTribSlots().get(1).getValue());
+ 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));
+ // 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));
+ }
+ break;
+ default:
+ LOG.error("service rate {} not managed yet", input.getServiceRate());
+ return;
+ }
+
+ // implement cross connect
+ List<String> createdConnections = new ArrayList<>();
+ if (!createdOduInterfaces.isEmpty()) {