Push service name to interfaces 40/76540/6
authorDhruv Bhardwaj <db929a@att.com>
Mon, 1 Oct 2018 17:35:46 +0000 (13:35 -0400)
committerDhruv Bhardwaj <db929a@att.com>
Thu, 4 Oct 2018 13:58:14 +0000 (13:58 +0000)
JIRA: TRNSPRTPCE-17
Change-Id: If47e38c645ca0c39610874d4674ca8245e489f84
Signed-off-by: Dhruv Bhardwaj <db929a@att.com.com>
renderer/src/main/java/org/opendaylight/transportpce/renderer/openroadminterface/OpenRoadmInterfaceFactory.java
renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/DeviceRendererServiceImpl.java

index 5d3b2a86eedde87c858047863aff58c1a17fc031..adb1c863d875457857020316b29584f092bcea57 100644 (file)
@@ -51,7 +51,7 @@ public class OpenRoadmInterfaceFactory {
         this.openRoadmInterfaces = openRoadmInterfaces;
     }
 
-    public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint)
+    public String createOpenRoadmEthInterface(String nodeId, String logicalConnPoint,String serviceName)
         throws OpenRoadmInterfaceException {
         Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
@@ -68,7 +68,7 @@ public class OpenRoadmInterfaceFactory {
         ethIfBuilder.setMtu(9000L);
 
         InterfaceBuilder ethInterfaceBldr = createGenericInterfaceBuilder(portMap, EthernetCsmacd.class,
-            logicalConnPoint + "-ETHERNET");
+            logicalConnPoint + "-ETHERNET",serviceName);
 
         // Create Interface1 type object required for adding as augmentation
         Interface1Builder ethIf1Builder = new Interface1Builder();
@@ -93,7 +93,8 @@ public class OpenRoadmInterfaceFactory {
      * @return Name of the interface if successful, otherwise return null.
      */
 
-    public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber)
+    public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber,
+                                              String serviceName)
         throws OpenRoadmInterfaceException {
         Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
@@ -102,7 +103,7 @@ public class OpenRoadmInterfaceFactory {
         }
         // Create generic interface
         InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
-            createOpenRoadmOchInterfaceName(logicalConnPoint, waveNumber));
+            createOpenRoadmOchInterfaceName(logicalConnPoint, waveNumber),serviceName);
 
         // OCH interface specific data
         OchBuilder ocIfBuilder = new OchBuilder();
@@ -132,7 +133,8 @@ public class OpenRoadmInterfaceFactory {
     }
 
     public String createOpenRoadmOchInterface(String nodeId, String logicalConnPoint, Long waveNumber, Class<
-        ? extends RateIdentity> rate, OchAttributes.ModulationFormat format) throws OpenRoadmInterfaceException {
+        ? extends RateIdentity> rate, OchAttributes.ModulationFormat format,String serviceName)
+        throws OpenRoadmInterfaceException {
         Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
             throw new OpenRoadmInterfaceException(String.format("Unable to get mapping from PortMapping for node %s and"
@@ -153,7 +155,7 @@ public class OpenRoadmInterfaceFactory {
             .interfaces.rev161014.Interface1Builder();
         // Create generic interface
         InterfaceBuilder ochInterfaceBldr = createGenericInterfaceBuilder(portMap, OpticalChannel.class,
-            createOpenRoadmOchInterfaceName(logicalConnPoint, waveNumber));
+            createOpenRoadmOchInterfaceName(logicalConnPoint, waveNumber),serviceName);
         ochInterfaceBldr.addAugmentation(
             org.opendaylight.yang.gen.v1.http.org.openroadm.optical.channel.interfaces.rev161014.Interface1.class,
             ochIf1Builder.setOch(ocIfBuilder.build()).build());
@@ -179,7 +181,8 @@ public class OpenRoadmInterfaceFactory {
      * @return Name of the interface if successful, otherwise return null.
      */
 
-    public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface)
+    public String createOpenRoadmOdu4Interface(String nodeId, String logicalConnPoint, String supportingOtuInterface,
+                                               String serviceName)
         throws OpenRoadmInterfaceException {
         Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
@@ -187,7 +190,7 @@ public class OpenRoadmInterfaceFactory {
                 + " logical connection port %s", nodeId, logicalConnPoint));
         }
         InterfaceBuilder oduInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOdu.class, logicalConnPoint
-            + "-ODU");
+            + "-ODU",serviceName);
         oduInterfaceBldr.setSupportingInterface(supportingOtuInterface);
 
         // ODU interface specific data
@@ -222,7 +225,8 @@ public class OpenRoadmInterfaceFactory {
      * @throws OpenRoadmInterfaceException OpenRoadmInterfaceException
      */
 
-    public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface)
+    public String createOpenRoadmOtu4Interface(String nodeId, String logicalConnPoint, String supportOchInterface,
+                                               String serviceName)
         throws OpenRoadmInterfaceException {
         Mapping portMap = this.portMapping.getMapping(nodeId, logicalConnPoint);
         if (portMap == null) {
@@ -231,7 +235,7 @@ public class OpenRoadmInterfaceFactory {
         }
         // Create generic interface
         InterfaceBuilder otuInterfaceBldr = createGenericInterfaceBuilder(portMap, OtnOtu.class, logicalConnPoint
-            + "-OTU");
+            + "-OTU",serviceName);
         otuInterfaceBldr.setSupportingInterface(supportOchInterface);
 
         // OTU interface specific data
@@ -256,7 +260,7 @@ public class OpenRoadmInterfaceFactory {
         if (mapping.getSupportingOts() == null) {
             // Create generic interface
             InterfaceBuilder otsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpticalTransport.class, "OTS-"
-                + mapping.getLogicalConnectionPoint());
+                + mapping.getLogicalConnectionPoint(),"");
             // OTS interface augmentation specific data
             OtsBuilder otsIfBuilder = new OtsBuilder();
             otsIfBuilder.setFiberType(FiberType.Smf);
@@ -281,7 +285,7 @@ public class OpenRoadmInterfaceFactory {
         if (mapping.getSupportingOms() == null) {
             // Create generic interface
             InterfaceBuilder omsInterfaceBldr = createGenericInterfaceBuilder(mapping, OpenROADMOpticalMultiplex.class,
-                "OMS-" + mapping.getLogicalConnectionPoint());
+                "OMS-" + mapping.getLogicalConnectionPoint(),"");
             if (mapping.getSupportingOts() != null) {
                 omsInterfaceBldr.setSupportingInterface(mapping.getSupportingOts());
             } else {
@@ -297,10 +301,10 @@ public class OpenRoadmInterfaceFactory {
     }
 
     private InterfaceBuilder createGenericInterfaceBuilder(Mapping portMap, Class<? extends InterfaceType> type,
-        String key) {
+                                                           String key,String serviceName) {
         InterfaceBuilder interfaceBuilder = new InterfaceBuilder();
         interfaceBuilder.setDescription("  TBD   ");
-        interfaceBuilder.setCircuitId("   TBD    ");
+        interfaceBuilder.setCircuitId(serviceName);
         interfaceBuilder.setSupportingCircuitPackName(portMap.getSupportingCircuitPackName());
         interfaceBuilder.setSupportingPort(portMap.getSupportingPort());
         interfaceBuilder.setAdministrativeState(AdminStates.InService);
index f2f47f415954db8635551c10827e655d2c54ab11..7aa43f896d37f484f2b40f149338f235a187321b 100644 (file)
@@ -81,20 +81,24 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
     private final OpenRoadmInterfaces openRoadmInterfaces;
     private final CrossConnect crossConnect;
     private final PortMapping portMapping;
+    private String serviceName;
 
     public DeviceRendererServiceImpl(DataBroker dataBroker, DeviceTransactionManager deviceTransactionManager,
-        OpenRoadmInterfaceFactory openRoadmInterfaceFactory, OpenRoadmInterfaces openRoadmInterfaces,
-        CrossConnect crossConnect, PortMapping portMapping) {
+                                     OpenRoadmInterfaceFactory openRoadmInterfaceFactory,
+                                     OpenRoadmInterfaces openRoadmInterfaces, CrossConnect crossConnect,
+                                     PortMapping portMapping) {
         this.dataBroker = dataBroker;
         this.deviceTransactionManager = deviceTransactionManager;
         this.openRoadmInterfaceFactory = openRoadmInterfaceFactory;
         this.openRoadmInterfaces = openRoadmInterfaces;
         this.crossConnect = crossConnect;
         this.portMapping = portMapping;
+        serviceName = "Undefined";
     }
 
     @Override
     public ServicePathOutput setupServicePath(ServicePathInput input, ServicePathDirection direction) {
+        this.serviceName = input.getServiceName();
         List<Nodes> nodes = input.getNodes();
         // Register node for suppressing alarms
         if (!alarmSuppressionNodeRegistration(input)) {
@@ -129,53 +133,53 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
                         crossConnectFlag++;
                         // create OpenRoadm Xponder Line Interfaces
                         String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
-                            nodeId, destTp, waveNumber, R100G.class, ModulationFormat.DpQpsk);
+                            nodeId, destTp, waveNumber, R100G.class, ModulationFormat.DpQpsk,serviceName);
                         createdOchInterfaces.add(supportingOchInterface);
 
                         String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
-                            nodeId, destTp, supportingOchInterface);
+                            nodeId, destTp, supportingOchInterface,serviceName);
                         createdOtuInterfaces.add(supportingOtuInterface);
 
                         createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId,
-                            destTp, supportingOtuInterface));
+                            destTp, supportingOtuInterface,serviceName));
                     }
                     if ((srcTp != null) && srcTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) {
                         crossConnectFlag++;
                         // create OpenRoadm Xponder Client Interfaces
                         createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId,
-                            srcTp));
+                            srcTp,serviceName));
 
                     }
                     if ((srcTp != null) && srcTp.contains(OpenRoadmInterfacesImpl.NETWORK_TOKEN)) {
                         crossConnectFlag++;
                         // create OpenRoadm Xponder Line Interfaces
                         String supportingOchInterface = this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(
-                            nodeId, srcTp, waveNumber, R100G.class, ModulationFormat.DpQpsk);
+                            nodeId, srcTp, waveNumber, R100G.class, ModulationFormat.DpQpsk,serviceName);
                         createdOchInterfaces.add(supportingOchInterface);
 
                         String supportingOtuInterface = this.openRoadmInterfaceFactory.createOpenRoadmOtu4Interface(
-                            nodeId, srcTp, supportingOchInterface);
+                            nodeId, srcTp, supportingOchInterface,serviceName);
                         createdOtuInterfaces.add(supportingOtuInterface);
 
                         createdOduInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOdu4Interface(nodeId,
-                            srcTp, supportingOtuInterface));
+                            srcTp, supportingOtuInterface,serviceName));
                     }
                     if ((destTp != null) && destTp.contains(OpenRoadmInterfacesImpl.CLIENT_TOKEN)) {
                         crossConnectFlag++;
                         // create OpenRoadm Xponder Client Interfaces
                         createdEthInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmEthInterface(nodeId,
-                            destTp));
+                            destTp,serviceName));
 
                     }
                     if ((srcTp != null) && (srcTp.contains(OpenRoadmInterfacesImpl.TTP_TOKEN) || srcTp.contains(
                         OpenRoadmInterfacesImpl.PP_TOKEN))) {
                         createdOchInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(nodeId,
-                            srcTp, waveNumber));
+                            srcTp, waveNumber,serviceName));
                     }
                     if ((destTp != null) && (destTp.contains(OpenRoadmInterfacesImpl.TTP_TOKEN) || destTp.contains(
                         OpenRoadmInterfacesImpl.PP_TOKEN))) {
                         createdOchInterfaces.add(this.openRoadmInterfaceFactory.createOpenRoadmOchInterface(nodeId,
-                            destTp, waveNumber));
+                            destTp, waveNumber,serviceName));
                     }
                     if (crossConnectFlag < 1) {
                         LOG.info("Creating cross connect between source {} and destination {} for node {}", srcTp,
@@ -184,8 +188,8 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
                             srcTp, destTp);
                         if (connectionNameOpt.isPresent()) {
                             nodesProvisioned.add(nodeId);
-                            List<Ports> ports = this.crossConnect.getConnectionPortTrail(nodeId, waveNumber, srcTp,
-                                destTp);
+                            List<Ports> ports = this.crossConnect
+                                .getConnectionPortTrail(nodeId, waveNumber, srcTp, destTp);
                             if (ServicePathDirection.A_TO_Z.equals(direction)) {
                                 topology.updateAtoZTopologyList(ports, nodeId);
                             }
@@ -251,7 +255,7 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
     }
 
     private ConcurrentLinkedQueue<String> processErrorMessage(String message, ForkJoinPool forkJoinPool,
-        ConcurrentLinkedQueue<String> messages) {
+                                                              ConcurrentLinkedQueue<String> messages) {
         LOG.warn(message);
         messages.add(message);
         forkJoinPool.shutdown();
@@ -431,8 +435,8 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
         InstanceIdentifier<
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist
                 .Nodelist> nodeListIID = InstanceIdentifier.create(ServiceNodelist.class).child(org.opendaylight.yang
-                        .gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist
-                        .Nodelist.class, new NodelistKey(input.getServiceName()));
+            .gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist
+            .Nodelist.class, new NodelistKey(input.getServiceName()));
         final WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction();
         writeTransaction.merge(LogicalDatastoreType.CONFIGURATION, nodeListIID, nodeListBuilder.build());
         Future<Void> submit = writeTransaction.submit();
@@ -447,33 +451,33 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
         }
     }
 
-    private boolean alarmSuppressionNodeRemoval(String serviceName) {
+    private boolean alarmSuppressionNodeRemoval(String name) {
         InstanceIdentifier<
             org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist
                 .Nodelist> nodeListIID = InstanceIdentifier.create(ServiceNodelist.class).child(org.opendaylight.yang
-                        .gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist
-                        .Nodelist.class, new NodelistKey(serviceName));
+            .gen.v1.urn.opendaylight.params.xml.ns.yang.alarmsuppression.rev171102.service.nodelist
+            .Nodelist.class, new NodelistKey(name));
         final WriteTransaction writeTransaction = this.dataBroker.newWriteOnlyTransaction();
         writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, nodeListIID);
         Future<Void> submit = writeTransaction.submit();
         try {
             submit.get(Timeouts.DATASTORE_DELETE, TimeUnit.MILLISECONDS);
-            LOG.info("Nodes are unregister for alarm suppression for service: {}", serviceName);
+            LOG.info("Nodes are unregister for alarm suppression for service: {}", name);
             return true;
 
         } catch (InterruptedException | TimeoutException | ExecutionException e) {
-            LOG.warn("Failed to alarm suppresslist for service: {}", serviceName, e);
+            LOG.warn("Failed to alarm suppresslist for service: {}", name, e);
             return false;
         }
     }
 
-    private void setTopologyForService(String serviceName, Topology topo) throws InterruptedException,
+    private void setTopologyForService(String name, Topology topo) throws InterruptedException,
         ExecutionException, TimeoutException {
 
         ServicesBuilder servicesBuilder;
         // Get the service from the service list inventory
 
-        ServicesKey serviceKey = new ServicesKey(serviceName);
+        ServicesKey serviceKey = new ServicesKey(name);
         InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
             serviceKey);
         Optional<Services> services;
@@ -544,4 +548,4 @@ public class DeviceRendererServiceImpl implements DeviceRendererService {
         }
         return output.setResult(result).setSuccess(success).build();
     }
-}
+}
\ No newline at end of file