From: Guillaume Lambert Date: Wed, 27 Jul 2022 08:07:35 +0000 (+0000) Subject: Merge "Switch tests from nose to pytest" X-Git-Tag: 6.0.0~44 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=98f18ed6198272340cbb1d12c6eb00aec42878eb;hp=cc99f4e64e885319e58912a8690d2101788d1962;p=transportpce.git Merge "Switch tests from nose to pytest" --- diff --git a/api/pom.xml b/api/pom.xml index cc6de817c..ff32883bc 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -37,6 +37,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html transportpce-ordmodels-service ${project.version} + + ${project.groupId}.ordmodels + transportpce-ordmodels-network + ${project.version} + ${project.groupId} transportpce-tapimodels diff --git a/api/src/main/yang/nbi-notifications@2021-08-13.yang b/api/src/main/yang/nbi-notifications@2021-10-13.yang similarity index 67% rename from api/src/main/yang/nbi-notifications@2021-08-13.yang rename to api/src/main/yang/nbi-notifications@2021-10-13.yang index b90e196a3..e55b7816b 100644 --- a/api/src/main/yang/nbi-notifications@2021-08-13.yang +++ b/api/src/main/yang/nbi-notifications@2021-10-13.yang @@ -12,6 +12,14 @@ module nbi-notifications { import org-openroadm-common-state-types { prefix org-openroadm-common-state-types; } + import tapi-common { + prefix tapi-common; + revision-date 2018-12-10; + } + import tapi-notification { + prefix tapi-notification; + revision-date 2018-12-10; + } organization "transportPCE"; @@ -21,6 +29,11 @@ module nbi-notifications { "YANG definitions for using REST API in NBI notifications module. Copyright (c) 2020 ORANGE and others. All rights reserved."; + revision 2021-10-13 { + description + "Implement new models, RPC for TAPI service notification"; + } + revision 2021-08-13 { description "Rename the groupings, containers and RPCs"; @@ -105,6 +118,69 @@ module nbi-notifications { } } + grouping notification-tapi-service { + leaf notification-type { + type tapi-notification:notification-type; + description "none"; + } + leaf target-object-type { + type tapi-notification:object-type; + description "none"; + } + leaf target-object-identifier { + type tapi-common:uuid; + description "none"; + } + list target-object-name { + key 'value-name'; + min-elements 1; + uses tapi-common:name-and-value; + description "none"; + } + leaf event-time-stamp { + type tapi-common:date-and-time; + description "none"; + } + leaf sequence-number { + type uint64; + config false; + description "A monotonous increasing sequence number associated with the notification. + The exact semantics of how this sequence number is assigned (per channel or subscription or source or system) is left undefined."; + } + leaf source-indicator { + type tapi-notification:source-indicator; + description "none"; + } + leaf layer-protocol-name { + type tapi-common:layer-protocol-name; + description "none"; + } + list changed-attributes { + key 'value-name'; + uses tapi-notification:name-and-value-change; + description "none"; + } + list additional-info { + key 'value-name'; + uses tapi-common:name-and-value; + description "none"; + } + leaf additional-text { + type string; + description "none"; + } + container tca-info { + uses tapi-notification:tca-info; + description "none"; + } + container alarm-info { + uses tapi-notification:alarm-info; + description "none"; + } + uses tapi-common:resource-spec; + description "none"; + } + container notification-process-service { description "Model used to send a notification from a service request"; @@ -117,6 +193,12 @@ module nbi-notifications { uses notification-alarm-service; } + container notification-tapi-service { + description + "Model used to send a tapi notification"; + uses notification-tapi-service; + } + rpc get-notifications-process-service { description "Get the notifications service sent by ServiceHandler through filtering connection type"; input { @@ -196,4 +278,15 @@ module nbi-notifications { } uses notification-alarm-service; } + + notification publish-tapi-notification-service { + description "Publish the TAPI notifications service for topic"; + leaf topic { + type string; + mandatory true; + description + "Topic where to send the notification service"; + } + uses tapi-notification:notification; + } } diff --git a/api/src/main/yang/transportpce-networkutils@2017-08-18.yang b/api/src/main/yang/transportpce-networkutils@2022-06-30.yang similarity index 57% rename from api/src/main/yang/transportpce-networkutils@2017-08-18.yang rename to api/src/main/yang/transportpce-networkutils@2022-06-30.yang index 8426fa31b..1e58eef1d 100644 --- a/api/src/main/yang/transportpce-networkutils@2017-08-18.yang +++ b/api/src/main/yang/transportpce-networkutils@2022-06-30.yang @@ -1,13 +1,69 @@ module transportpce-networkutils { - yang-version 1; + yang-version 1.1; namespace "http://org/opendaylight/transportpce/networkutils"; prefix org-opendaylight-transportpce-networkutils; + import ietf-network { + prefix nd; + revision-date 2018-02-26; + } + import ietf-network-topology { + prefix nwt; + revision-date 2018-02-26; + } + import org-openroadm-common-network { + prefix cnet; + revision-date 2021-12-10; + } + + revision 2022-06-30 { + description + "Add transportpce augmentation to manage otn-link-type in otn-topology"; + } + revision 2017-08-18 { description "Initial revision of networkutils model"; } + typedef otn-link-type { + type enumeration { + enum "OTU4" { + value 0; + } + enum "ODU4" { + value 1; + } + enum "ODTU4" { + value 2; + } + enum "ODU2e" { + value 3; + } + enum "ODU0" { + value 4; + } + enum "OTUC4" { + value 5; + } + enum "ODUC4" { + value 6; + } + enum "OTUC3" { + value 7; + } + enum "ODUC3" { + value 8; + } + enum "OTUC2" { + value 9; + } + enum "ODUC2" { + value 10; + } + } + } + grouping links-input-grouping { container links-input { description @@ -103,4 +159,17 @@ module transportpce-networkutils { } } } + + augment "/nd:networks/nd:network/nwt:link" { + when "../nd:network-types/cnet:openroadm-common-network/otn-topology"; + description + "Defines more accurate otn link types to differentiate otn links in otn-topology"; + leaf otn-link-type { + when + "../cnet:link-type = 'OTN-LINK'"; + type otn-link-type; + description + "type of otn link, to help link management inside transportpce"; + } + } } diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/impl/DmaapClientProvider.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/impl/DmaapClientProvider.java index 63bee5357..482a46b78 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/impl/DmaapClientProvider.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/impl/DmaapClientProvider.java @@ -9,7 +9,7 @@ package org.opendaylight.transportpce.dmaap.client.impl; import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.transportpce.dmaap.client.listener.NbiNotificationsListenerImpl; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImpl.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImpl.java index 4a91e6a4c..fcf0b000d 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImpl.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImpl.java @@ -17,9 +17,10 @@ import org.glassfish.jersey.logging.LoggingFeature; import org.opendaylight.transportpce.dmaap.client.resource.EventsApi; import org.opendaylight.transportpce.dmaap.client.resource.config.JsonConfigurator; import org.opendaylight.transportpce.dmaap.client.resource.model.CreatedEvent; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -55,7 +56,9 @@ public class NbiNotificationsListenerImpl implements NbiNotificationsListener { @Override public void onPublishNotificationAlarmService(PublishNotificationAlarmService notification) { - } + @Override + public void onPublishTapiNotificationService(PublishTapiNotificationService notification) { + } } diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/EventsApi.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/EventsApi.java index e6f167824..4284f8656 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/EventsApi.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/EventsApi.java @@ -14,7 +14,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.opendaylight.transportpce.dmaap.client.resource.model.CreatedEvent; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; @Path("/events") public interface EventsApi { diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceModule.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceModule.java index 9fcbf9f2a..5ae404b15 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceModule.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceModule.java @@ -13,9 +13,9 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirection; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.lgx.Lgx; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.port.Port; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEnd; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEnd; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEnd; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEnd; //This class is a temporary workaround while waiting jackson //support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852 diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceSerializer.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceSerializer.java index b9b650ce0..5361e3fa0 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceSerializer.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/PublishNotificationProcessServiceSerializer.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import java.io.IOException; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; // This class is a temporary workaround while waiting jackson // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852 diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceAEndSerializer.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceAEndSerializer.java index e05e0fcbb..3d48bf57e 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceAEndSerializer.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceAEndSerializer.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import java.io.IOException; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEnd; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEnd; // This class is a temporary workaround while waiting jackson // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852 diff --git a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceZEndSerializer.java b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceZEndSerializer.java index 2e1ae2835..b31bf5db6 100644 --- a/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceZEndSerializer.java +++ b/dmaap-client/src/main/java/org/opendaylight/transportpce/dmaap/client/resource/config/ServiceZEndSerializer.java @@ -11,7 +11,7 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import java.io.IOException; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEnd; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEnd; // This class is a temporary workaround while waiting jackson // support in yang tools https://git.opendaylight.org/gerrit/c/yangtools/+/94852 diff --git a/dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImplTest.java b/dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImplTest.java index 363653b2a..f3df78362 100644 --- a/dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImplTest.java +++ b/dmaap-client/src/test/java/org/opendaylight/transportpce/dmaap/client/listener/NbiNotificationsListenerImplTest.java @@ -28,11 +28,11 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirectionKey; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint8; import org.slf4j.LoggerFactory; diff --git a/docs/developer-guide.rst b/docs/developer-guide.rst index ca95df191..20817b27e 100644 --- a/docs/developer-guide.rst +++ b/docs/developer-guide.rst @@ -28,7 +28,7 @@ equipment\_ and Optical Line Management (OLM) is associated with a generic block relying on open models, each of them communicating through published APIs. -.. figure:: ./images/TransportPCE-Diagram-Phosphorus.jpg +.. figure:: ./images/TransportPCE-Diagram-Sulfur.jpg :alt: TransportPCE architecture TransportPCE architecture @@ -1510,16 +1510,19 @@ odl-transportpce-tapi This feature allows TransportPCE application to expose at its northbound interface other APIs than those defined by the OpenROADM MSA. With this feature, TransportPCE provides part of the Transport-API -specified by the Open Networking Foundation. More specifically, the Topology Service and Connectivity -Service components are implemented, allowing to expose to higher level applications an abstraction of -its OpenROADM topologies in the form of topologies respecting the T-API modelling, as well as -creating/deleting connectivity services between the Service Interface Points (SIPs) exposed by the -T-API topology. The current version of TransportPCE implements the *tapi-topology.yang* and -*tapi-connectivity.yang* models in the revision 2018-12-10 (T-API v2.1.2). +specified by the Open Networking Foundation. More specifically, the Topology Service, Connectivity and Notification +Service components are implemented, allowing to: -Additionally, support for the Notification Service component will be added in future releases, which -will allow higher level applications to create/delete a Notification Subscription Service to receive -several T-API notifications as defined in the *tapi-notification.yang* model. +1. Expose to higher level applications an abstraction of its OpenROADM topologies in the form of topologies respecting the T-API modelling. +2. Create/delete connectivity services between the Service Interface Points (SIPs) exposed by the T-API topology. +3. Create/Delete Notification Subscription Service to expose to higher level applications T-API notifications through a Kafka server. + +The current version of TransportPCE implements the *tapi-topology.yang*, +*tapi-connectivity.yang* and *tapi-notification.yang* models in the revision +2018-12-10 (T-API v2.1.2). + +Additionally, support for the Path Computation Service will be added in future releases, which will allow T-PCE +to compute a path over the T-API topology. T-API Topology Service ~~~~~~~~~~~~~~~~~~~~~~ @@ -1666,7 +1669,7 @@ The user can provide, either the Uuid associated to the attribute or its name. { "tapi-topology:input": { "tapi-topology:topology-id-or-name": "T0 - Full Multi-layer topology", - "tapi-topology:node-id-or-name": "ROADM-A1+PHOTONINC_MEDIA" + "tapi-topology:node-id-or-name": "ROADM-A1+PHOTONIC_MEDIA" } } @@ -1682,8 +1685,8 @@ The user can provide, either the Uuid associated to the attribute or its name. { "tapi-topology:input": { "tapi-topology:topology-id-or-name": "T0 - Full Multi-layer topology", - "tapi-topology:node-id-or-name": "ROADM-A1+PHOTONINC_MEDIA", - "tapi-topology:ep-id-or-name": "ROADM-A1+PHOTONINC_MEDIA+DEG1-TTP-TXRX" + "tapi-topology:node-id-or-name": "ROADM-A1+PHOTONIC_MEDIA", + "tapi-topology:ep-id-or-name": "ROADM-A1+PHOTONIC_MEDIA+DEG1-TTP-TXRX" } } @@ -1907,10 +1910,141 @@ connectivity service. T-API Notification Service ~~~~~~~~~~~~~~~~~~~~~~~~~~ -In future releases, the T-API notification service will be implemented. The objective will be to write and read -T-API notifications stored in topics of a Kafka server as explained later in the odl-transportpce-nbinotifications -section, but T-API based. +- RPC calls implemented: + + - create-notification-subscription-service + + - get-supported-notification-types + + - delete-notification-subscription-service + + - get-notification-subscription-service-details + + - get-notification-subscription-service-list + + - get-notification-list + +Sulfur SR1 extends the T-API interface support by implementing the T-API notification service. This feature +allows TransportPCE to write and read tapi-notifications stored in topics of a Kafka server. It also upgrades +the nbinotifications module to support the serialization and deserialization of tapi-notifications into JSON +format and vice-versa. Current implementation of the notification service creates a Kafka topic and stores +tapi-notification on reception of a create-notification-subscription-service request. Only connectivity-service +related notifications are stored in the Kafka server. + +In comparison with openroadm notifications, in which several pre-defined kafka topics are created on nbinotification +module instantiation, tapi-related kafka topics are created on-demand. Upon reception of a +*create-notification-subscription-service request*, a new topic will be created in the Kafka server. +This topic is named after the connectivity-service UUID. + +.. note:: + Creating a Notification Subscription Service could include a list of T-API object UUIDs, therefore 1 topic per UUID + is created in the Kafka server. + +In the current implementation, only Connectivity Service related notification are supported. + +**REST API** : *POST /restconf/operations/tapi-notification:get-supported-notification-types* + +The response body will include the type of notifications supported and the object types + +Use the following RPC to create a Notification Subscription Service. + +**REST API** : *POST /restconf/operations/tapi-notification:create-notification-subscription-service* + +**Sample JSON Data** + +.. code:: json + + { + "tapi-notification:input": { + "tapi-notification:subscription-filter": { + "tapi-notification:requested-notification-types": [ + "ALARM_EVENT" + ], + "tapi-notification:requested-object-types": [ + "CONNECTIVITY_SERVICE" + ], + "tapi-notification:requested-layer-protocols": [ + "" + ], + "tapi-notification:requested-object-identifier": [ + "" + ], + "tapi-notification:include-content": true, + "tapi-notification:local-id": "localId", + "tapi-notification:name": [ + { + "tapi-notification:value-name": "Subscription name", + "tapi-notification:value": "" + } + ] + }, + "tapi-notification:subscription-state": "ACTIVE" + } + } + +This call will return the *UUID* of the Notification Subscription service, which can later be used to retrieve the +details of the created subscription, to delete the subscription (and all the related kafka topics) or to retrieve +all the tapi notifications related to that subscription service. + +The figure below shows an example of the application of tapi and nbinotifications in order to notify when there is +a connectivity service creation process. Depending on the status of the process a tapi-notification with the +corresponding updated state of the connectivity service is sent to the topic "Service_UUID". + +.. figure:: ./images/TransportPCE-tapi-nbinotifications-service-example.jpg + :alt: Example of tapi connectivity service notifications using the feature nbinotifications in TransportPCE + +Additionally, when a connectivity service breaks down or is restored a tapi notification alarming the new status +will be sent to a Kafka Server. Below an example of a tapi notification is shown. + +**Sample JSON T-API notification** + +.. code:: json + + { + "nbi-notifications:notification-tapi-service": { + "layer-protocol-name": "", + "notification-type": "ATTRIBUTE_VALUE_CHANGE", + "changed-attributes": [ + { + "value-name": "administrativeState", + "old-value": "", + "new-value": "" + }, + { + "value-name": "operationalState", + "old-value": "DISABLED_OR_ENABLED", + "new-value": "ENABLED_OR_DISABLED" + } + ], + "target-object-name": [ + { + "value-name": "Connectivity Service Name", + "value": "" + } + ], + "uuid": "", + "target-object-type": "CONNECTIVITY_SERVICE", + "event-time-stamp": "2022-04-06T09:06:01+00:00", + "target-object-identifier": "" + } + } + +To retrieve these tapi connectivity service notifications stored in the kafka server: + +**REST API** : *POST /restconf/operations/tapi-notification:get-notification-list* + +**Sample JSON Data** + +.. code:: json + + { + "tapi-notification:input": { + "tapi-notification:subscription-id-or-name": "", + "tapi-notification:time-period": "time-period" + } + } +Further development will support more types of T-API objects, i.e., node, link, topology, connection... odl-transportpce-dmaap-client ----------------------------- diff --git a/docs/images/TransportPCE-Diagram-Sulfur.jpg b/docs/images/TransportPCE-Diagram-Sulfur.jpg new file mode 100644 index 000000000..b39e8e0b6 Binary files /dev/null and b/docs/images/TransportPCE-Diagram-Sulfur.jpg differ diff --git a/docs/images/TransportPCE-tapi-nbinotifications-service-example.jpg b/docs/images/TransportPCE-tapi-nbinotifications-service-example.jpg new file mode 100644 index 000000000..8c85d2dfe Binary files /dev/null and b/docs/images/TransportPCE-tapi-nbinotifications-service-example.jpg differ diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java b/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java index fb3a8f828..a10b7f04b 100644 --- a/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java +++ b/lighty/src/main/java/io/lighty/controllers/tpce/module/TransportPCEImpl.java @@ -92,7 +92,7 @@ import org.opendaylight.transportpce.tapi.topology.TapiOrLinkListener; import org.opendaylight.transportpce.tapi.topology.TapiPortMappingListener; import org.opendaylight.transportpce.tapi.utils.TapiLink; import org.opendaylight.transportpce.tapi.utils.TapiListener; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.TransportpceNetworkutilsService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.TransportpceNetworkutilsService; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.TransportpceOlmService; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.tapinetworkutils.rev210408.TransportpceTapinetworkutilsService; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService; @@ -215,7 +215,7 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP R2RTapiLinkDiscovery tapilinkDiscoveryImpl = new R2RTapiLinkDiscovery(networkTransaction, deviceTransactionManager, tapiLink); TapiRendererListenerImpl tapiRendererListenerImpl = new TapiRendererListenerImpl(lightyServices - .getBindingDataBroker()); + .getBindingDataBroker(), lightyServices.getBindingNotificationPublishService()); TapiPceListenerImpl tapiPceListenerImpl = new TapiPceListenerImpl(lightyServices.getBindingDataBroker()); TapiServiceHandlerListenerImpl tapiServiceHandlerListener = new TapiServiceHandlerListenerImpl( lightyServices.getBindingDataBroker()); @@ -230,7 +230,8 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP TapiPortMappingListener tapiPortMappingListener = new TapiPortMappingListener(tapiNetworkModelService); TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl = - new TapiNetworkModelListenerImpl(networkTransaction); + new TapiNetworkModelListenerImpl(networkTransaction, + lightyServices.getBindingNotificationPublishService()); tapiProvider = initTapi(lightyServices, servicehandler, networkTransaction, serviceDataStoreOperations, tapiNetConfTopologyListener, tapiPortMappingListener, tapiNetworkutilsServiceImpl, @@ -240,8 +241,9 @@ public class TransportPCEImpl extends AbstractLightyModule implements TransportP if (activateNbiNotification) { LOG.info("Creating nbi-notifications beans ..."); nbiNotificationsProvider = new NbiNotificationsProvider( - publisherServiceList, publisherAlarmList, null, null, lightyServices.getRpcProviderService(), - lightyServices.getNotificationService(), lightyServices.getAdapterContext().currentSerializer()); + publisherServiceList, publisherAlarmList, null, null, lightyServices.getRpcProviderService(), + lightyServices.getNotificationService(), lightyServices.getAdapterContext().currentSerializer(), + networkTransaction); } } diff --git a/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java b/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java index ab28ae2d8..18d5b5e73 100644 --- a/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java +++ b/lighty/src/main/java/io/lighty/controllers/tpce/utils/TPCEUtils.java @@ -310,7 +310,7 @@ public final class TPCEUtils { // API models / opendaylight org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.alarmsuppression.rev171102 .$YangModuleInfoImpl.getInstance(), - org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.$YangModuleInfoImpl + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.$YangModuleInfoImpl .getInstance(), org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.$YangModuleInfoImpl .getInstance(), @@ -341,7 +341,6 @@ public final class TPCEUtils { .$YangModuleInfoImpl.getInstance(), org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.$YangModuleInfoImpl .getInstance(), - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.$YangModuleInfoImpl.getInstance(), org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.$YangModuleInfoImpl .getInstance(), @@ -365,7 +364,7 @@ public final class TPCEUtils { .getInstance(), org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.$YangModuleInfoImpl .getInstance(), - org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.$YangModuleInfoImpl + org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.$YangModuleInfoImpl .getInstance()); private static final Set TPCE_YANG_MODEL = Stream.concat( diff --git a/nbinotifications/pom.xml b/nbinotifications/pom.xml index 96ff011b6..552c3c2b0 100644 --- a/nbinotifications/pom.xml +++ b/nbinotifications/pom.xml @@ -41,6 +41,11 @@ transportpce-api ${project.version} + + ${project.groupId} + transportpce-tapimodels + ${project.version} + ${project.groupId} transportpce-common diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/consumer/Subscriber.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/consumer/Subscriber.java index 7ebc0bdf6..154cbb80f 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/consumer/Subscriber.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/consumer/Subscriber.java @@ -18,6 +18,7 @@ import org.apache.kafka.clients.consumer.ConsumerConfig; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecords; import org.apache.kafka.clients.consumer.KafkaConsumer; +import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.serialization.StringDeserializer; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.transportpce.common.converter.JsonStringConverter; @@ -39,6 +40,7 @@ public class Subscriber { Properties propsConsumer = NbiNotificationsUtils.loadProperties("subscriber.properties"); propsConsumer.put(ConsumerConfig.GROUP_ID_CONFIG, groupId); propsConsumer.put(ConsumerConfig.CLIENT_ID_CONFIG, id); + propsConsumer.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, false); propsConsumer.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class); propsConsumer.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG , deserializerConf); propsConsumer.put(ConfigConstants.CONVERTER , deserializer); @@ -55,7 +57,7 @@ public class Subscriber { final ConsumerRecords consumerRecords = consumer.poll(Duration.ofMillis(1000)); List notificationServiceList = new ArrayList<>(); YangInstanceIdentifier.of(name); - for (ConsumerRecord record : consumerRecords) { + for (ConsumerRecord record : consumerRecords.records(new TopicPartition(topicName, 0))) { if (record.value() != null) { notificationServiceList.add(record.value()); } diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImpl.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImpl.java index 77f6f8552..0a23c16e0 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImpl.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImpl.java @@ -8,38 +8,101 @@ package org.opendaylight.transportpce.nbinotifications.impl; import com.google.common.util.concurrent.ListenableFuture; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.ExecutionException; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.converter.JsonStringConverter; +import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.nbinotifications.consumer.Subscriber; import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceDeserializer; import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceDeserializer; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInput; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutputBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInput; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutputBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService; +import org.opendaylight.transportpce.nbinotifications.serialization.TapiNotificationDeserializer; +import org.opendaylight.transportpce.nbinotifications.utils.TopicManager; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceInput; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutput; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutputBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceInput; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutput; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutputBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.CreateNotificationSubscriptionServiceOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.DeleteNotificationSubscriptionServiceInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.DeleteNotificationSubscriptionServiceOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.DeleteNotificationSubscriptionServiceOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationListInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationListOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationListOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceDetailsInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceDetailsOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceDetailsOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceListInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceListOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetNotificationSubscriptionServiceListOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetSupportedNotificationTypesInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetSupportedNotificationTypesOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.GetSupportedNotificationTypesOutputBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationService; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.UpdateNotificationSubscriptionServiceInput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.UpdateNotificationSubscriptionServiceOutput; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContext; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContextBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.create.notification.subscription.service.output.SubscriptionService; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.create.notification.subscription.service.output.SubscriptionServiceBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.Notification; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.NotificationKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.subscription.service.list.output.SubscriptionServiceKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.context.NotifSubscription; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.context.NotifSubscriptionBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.context.NotifSubscriptionKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.subscription.service.SubscriptionFilter; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.subscription.service.SubscriptionFilterBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.ErrorType; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NbiNotificationsImpl implements NbiNotificationsService { +public class NbiNotificationsImpl implements NbiNotificationsService, TapiNotificationService { private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsImpl.class); private final JsonStringConverter converterService; private final JsonStringConverter converterAlarmService; + private final JsonStringConverter converterTapiService; private final String server; + private final NetworkTransactionService networkTransactionService; + private final TopicManager topicManager; public NbiNotificationsImpl(JsonStringConverter converterService, - JsonStringConverter converterAlarmService, String server) { + JsonStringConverter converterAlarmService, + JsonStringConverter converterTapiService, String server, + NetworkTransactionService networkTransactionService, TopicManager topicManager) { this.converterService = converterService; this.converterAlarmService = converterAlarmService; + this.converterTapiService = converterTapiService; this.server = server; + this.networkTransactionService = networkTransactionService; + this.topicManager = topicManager; } @Override @@ -75,4 +138,292 @@ public class NbiNotificationsImpl implements NbiNotificationsService { return RpcResultBuilder.success(new GetNotificationsAlarmServiceOutputBuilder() .setNotificationsAlarmService(notificationAlarmServiceList).build()).buildFuture(); } + + @Override + public ListenableFuture> + getSupportedNotificationTypes(GetSupportedNotificationTypesInput input) { + NotificationContext notificationContext = getNotificationContext(); + if (notificationContext == null) { + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, "Couldnt get Notification Context from Datastore") + .buildFuture(); + } + if (notificationContext.getNotifSubscription() == null) { + return RpcResultBuilder.success(new GetSupportedNotificationTypesOutputBuilder() + .setSupportedNotificationTypes(new HashSet<>()) + .setSupportedObjectTypes(new HashSet<>()).build()).buildFuture(); + } + Set notificationTypeList = new HashSet<>(); + Set objectTypeList = new HashSet<>(); + for (NotifSubscription notifSubscription:notificationContext.getNotifSubscription().values()) { + if (notifSubscription.getSupportedNotificationTypes() != null) { + notificationTypeList.addAll(notifSubscription.getSupportedNotificationTypes()); + } + if (notifSubscription.getSupportedObjectTypes() != null) { + objectTypeList.addAll(notifSubscription.getSupportedObjectTypes()); + } + } + return RpcResultBuilder.success(new GetSupportedNotificationTypesOutputBuilder() + .setSupportedNotificationTypes(notificationTypeList) + .setSupportedObjectTypes(objectTypeList).build()).buildFuture(); + } + + @Override + public ListenableFuture> + createNotificationSubscriptionService(CreateNotificationSubscriptionServiceInput input) { + for (Uuid uuid:input.getSubscriptionFilter().getRequestedObjectIdentifier()) { + LOG.info("Adding T-API topic: {} to Kafka server", uuid.getValue()); + this.topicManager.addTapiTopic(uuid.getValue()); + } + SubscriptionFilter subscriptionFilter = new SubscriptionFilterBuilder() + .setName(input.getSubscriptionFilter().getName()) + .setLocalId(input.getSubscriptionFilter().getLocalId()) + .setIncludeContent(input.getSubscriptionFilter().getIncludeContent()) + .setRequestedNotificationTypes(input.getSubscriptionFilter().getRequestedNotificationTypes()) + .setRequestedLayerProtocols(input.getSubscriptionFilter().getRequestedLayerProtocols()) + .setRequestedObjectIdentifier(input.getSubscriptionFilter().getRequestedObjectIdentifier()) + .setRequestedObjectTypes(input.getSubscriptionFilter().getRequestedObjectTypes()) + .build(); + Uuid notifSubscriptionUuid = new Uuid(UUID.randomUUID().toString()); + SubscriptionService subscriptionService = new SubscriptionServiceBuilder() + .setSubscriptionFilter(subscriptionFilter) + .setSubscriptionState(input.getSubscriptionState()) + .setUuid(notifSubscriptionUuid) + .build(); + + NotifSubscriptionKey notifSubscriptionKey = new NotifSubscriptionKey(notifSubscriptionUuid); + Set notificationTypes = (subscriptionFilter.getRequestedNotificationTypes() != null) + ? subscriptionFilter.getRequestedNotificationTypes() + : new HashSet<>(List.of(NotificationType.ALARMEVENT)); + Set objectTypes = (subscriptionFilter.getRequestedObjectTypes() != null) + ? subscriptionFilter.getRequestedObjectTypes() + : new HashSet<>(List.of(ObjectType.CONNECTIVITYSERVICE)); + NotifSubscription notifSubscription = new NotifSubscriptionBuilder() + .setSubscriptionState(subscriptionService.getSubscriptionState()) + .setSubscriptionFilter(subscriptionService.getSubscriptionFilter()) + .setUuid(notifSubscriptionUuid) + .setSupportedNotificationTypes(notificationTypes) + .setSupportedObjectTypes(objectTypes) + .setName(subscriptionService.getName()) + .build(); + NotificationContext notificationContext = getNotificationContext(); + Map notifSubscriptions = new HashMap<>(); + if (notificationContext != null && notificationContext.getNotifSubscription() != null) { + notifSubscriptions.putAll(notificationContext.getNotifSubscription()); + } + notifSubscriptions.put(notifSubscriptionKey, notifSubscription); + NotificationContext notificationContext1 = new NotificationContextBuilder() + .setNotification(notificationContext == null ? new HashMap<>() : notificationContext.getNotification()) + .setNotifSubscription(notifSubscriptions) + .build(); + if (!updateNotificationContext(notificationContext1)) { + LOG.error("Failed to update Notification context"); + return RpcResultBuilder.failed() + .withError(ErrorType.RPC, "Failed to update notification context").buildFuture(); + } + CreateNotificationSubscriptionServiceOutput serviceOutput = + new CreateNotificationSubscriptionServiceOutputBuilder() + .setSubscriptionService(subscriptionService) + .build(); + return RpcResultBuilder.success(serviceOutput).buildFuture(); + } + + @Override + public ListenableFuture> + updateNotificationSubscriptionService(UpdateNotificationSubscriptionServiceInput input) { + // TODO --> Not yet implemented + return null; + } + + @Override + public ListenableFuture> + deleteNotificationSubscriptionService(DeleteNotificationSubscriptionServiceInput input) { + try { + if (input == null || input.getSubscriptionIdOrName() == null) { + LOG.warn("Missing mandatory params for input {}", input); + return RpcResultBuilder.failed() + .withError(ErrorType.RPC, "Missing input parameters").buildFuture(); + } + Uuid notifSubsUuid = getUuidFromIput(input.getSubscriptionIdOrName()); + InstanceIdentifier notifSubscriptionIID = InstanceIdentifier.builder(Context.class) + .augmentation(Context1.class).child(NotificationContext.class).child(NotifSubscription.class, + new NotifSubscriptionKey(notifSubsUuid)).build(); + Optional optionalNotifSub = this.networkTransactionService.read( + LogicalDatastoreType.OPERATIONAL, notifSubscriptionIID).get(); + + if (!optionalNotifSub.isPresent()) { + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, + "Notification subscription doesnt exist").buildFuture(); + } + NotifSubscription notifSubscription = optionalNotifSub.get(); + this.networkTransactionService.delete(LogicalDatastoreType.OPERATIONAL, notifSubscriptionIID); + this.networkTransactionService.commit().get(); + for (Uuid objectUuid:notifSubscription.getSubscriptionFilter().getRequestedObjectIdentifier()) { + this.topicManager.deleteTapiTopic(objectUuid.getValue()); + } + return RpcResultBuilder.success(new DeleteNotificationSubscriptionServiceOutputBuilder().build()) + .buildFuture(); + } catch (InterruptedException | ExecutionException | NoSuchElementException e) { + LOG.error("Failed to delete Notification subscription service", e); + } + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, + "Failed to delete notification subscription service").buildFuture(); + } + + @Override + public ListenableFuture> + getNotificationSubscriptionServiceDetails(GetNotificationSubscriptionServiceDetailsInput input) { + if (input == null || input.getSubscriptionIdOrName() == null) { + LOG.warn("Missing mandatory params for input {}", input); + return RpcResultBuilder.failed() + .withError(ErrorType.RPC, "Missing input parameters").buildFuture(); + } + Uuid notifSubsUuid = getUuidFromIput(input.getSubscriptionIdOrName()); + NotificationContext notificationContext = getNotificationContext(); + if (notificationContext == null) { + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, "Notification context is empty") + .buildFuture(); + } + if (notificationContext.getNotifSubscription() == null) { + return RpcResultBuilder.success(new GetNotificationSubscriptionServiceDetailsOutputBuilder() + .setSubscriptionService(new org.opendaylight.yang.gen.v1 + .urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.subscription.service + .details.output.SubscriptionServiceBuilder().build()).build()).buildFuture(); + } + if (!notificationContext.getNotifSubscription().containsKey(new NotifSubscriptionKey(notifSubsUuid))) { + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, + "Notification subscription service doesnt exist").buildFuture(); + } + return RpcResultBuilder.success(new GetNotificationSubscriptionServiceDetailsOutputBuilder() + .setSubscriptionService(new org.opendaylight.yang.gen.v1.urn + .onf.otcc.yang.tapi.notification.rev181210.get.notification.subscription.service.details.output + .SubscriptionServiceBuilder(notificationContext.getNotifSubscription().get( + new NotifSubscriptionKey(notifSubsUuid))).build()).build()).buildFuture(); + } + + @Override + public ListenableFuture> + getNotificationSubscriptionServiceList(GetNotificationSubscriptionServiceListInput input) { + NotificationContext notificationContext = getNotificationContext(); + if (notificationContext == null) { + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, "Notification context is empty") + .buildFuture(); + } + if (notificationContext.getNotifSubscription() == null) { + return RpcResultBuilder.success(new GetNotificationSubscriptionServiceListOutputBuilder() + .setSubscriptionService(new HashMap<>()).build()).buildFuture(); + } + Map + notifSubsMap = new HashMap<>(); + for (NotifSubscription notifSubscription:notificationContext.getNotifSubscription().values()) { + org.opendaylight.yang.gen.v1.urn.onf.otcc.yang + .tapi.notification.rev181210.get.notification.subscription.service.list.output.SubscriptionService + subscriptionService = new org.opendaylight.yang.gen.v1 + .urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.subscription.service + .list.output.SubscriptionServiceBuilder(notifSubscription).build(); + notifSubsMap.put(subscriptionService.key(), subscriptionService); + } + return RpcResultBuilder.success(new GetNotificationSubscriptionServiceListOutputBuilder() + .setSubscriptionService(notifSubsMap).build()).buildFuture(); + } + + @Override + public ListenableFuture> getNotificationList(GetNotificationListInput input) { + try { + LOG.info("RPC getNotificationList received"); + if (input == null || input.getSubscriptionIdOrName() == null) { + LOG.warn("Missing mandatory params for input {}", input); + return RpcResultBuilder.failed().withError(ErrorType.RPC, + "Missing input parameters").buildFuture(); + } + Uuid notifSubsUuid = getUuidFromIput(input.getSubscriptionIdOrName()); + InstanceIdentifier notifSubscriptionIID = InstanceIdentifier.builder(Context.class) + .augmentation(Context1.class).child(NotificationContext.class).child(NotifSubscription.class, + new NotifSubscriptionKey(notifSubsUuid)).build(); + Optional optionalNotifSub = this.networkTransactionService.read( + LogicalDatastoreType.OPERATIONAL, notifSubscriptionIID).get(); + + if (!optionalNotifSub.isPresent()) { + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, + "Notification subscription doesnt exist").buildFuture(); + } + NotifSubscription notifSubscription = optionalNotifSub.get(); + List notificationTapiList = new ArrayList<>(); + for (Uuid objectUuid:notifSubscription.getSubscriptionFilter().getRequestedObjectIdentifier()) { + if (!this.topicManager.getTapiTopicMap().containsKey(objectUuid.getValue())) { + LOG.warn("Topic doesnt exist for {}", objectUuid.getValue()); + continue; + } + LOG.info("Going to get notifications for topic {}", objectUuid.getValue()); + Subscriber subscriber = new Subscriber<>( + objectUuid.getValue(), objectUuid.getValue(), server, converterTapiService, + TapiNotificationDeserializer.class); + notificationTapiList.addAll(subscriber.subscribe(objectUuid.getValue(), Notification.QNAME)); + } + LOG.info("TAPI notifications = {}", notificationTapiList); + Map notificationMap = new HashMap<>(); + for (Notification notif:notificationTapiList) { + notificationMap.put(notif.key(), notif); + } + return RpcResultBuilder.success(new GetNotificationListOutputBuilder() + .setNotification(notificationMap).build()).buildFuture(); + } catch (InterruptedException | ExecutionException | NoSuchElementException e) { + LOG.error("Failed to get Notifications from Kafka", e); + } + return RpcResultBuilder.failed() + .withError(ErrorType.APPLICATION, + "Notifications couldnt be retrieved from Kafka server").buildFuture(); + } + + private NotificationContext getNotificationContext() { + LOG.info("Getting tapi notification context"); + try { + InstanceIdentifier notificationcontextIID = + InstanceIdentifier.builder(Context.class).augmentation(Context1.class) + .child(NotificationContext.class).build(); + Optional notificationContextOptional + = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, notificationcontextIID).get(); + if (!notificationContextOptional.isPresent()) { + LOG.error("Could not get TAPI notification context"); + return null; + } + return notificationContextOptional.get(); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Could not get TAPI notification context"); + } + return null; + } + + private boolean updateNotificationContext(NotificationContext notificationContext1) { + try { + InstanceIdentifier notificationcontextIID = + InstanceIdentifier.builder(Context.class).augmentation(Context1.class) + .child(NotificationContext.class).build(); + this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, notificationcontextIID, + notificationContext1); + this.networkTransactionService.commit().get(); + return true; + } catch (InterruptedException | ExecutionException e) { + LOG.error("Could not update TAPI notification context"); + } + return false; + } + + private Uuid getUuidFromIput(String serviceIdOrName) { + try { + UUID.fromString(serviceIdOrName); + LOG.info("Given attribute {} is a UUID", serviceIdOrName); + return new Uuid(serviceIdOrName); + } catch (IllegalArgumentException e) { + LOG.info("Given attribute {} is not a UUID", serviceIdOrName); + return new Uuid(UUID.nameUUIDFromBytes(serviceIdOrName.getBytes(StandardCharsets.UTF_8)).toString()); + } + } } diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProvider.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProvider.java index 24c0383e4..863d689a3 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProvider.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProvider.java @@ -14,14 +14,16 @@ import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.api.RpcProviderService; import org.opendaylight.mdsal.binding.dom.codec.spi.BindingDOMCodecServices; import org.opendaylight.transportpce.common.converter.JsonStringConverter; +import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl; import org.opendaylight.transportpce.nbinotifications.producer.Publisher; -import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer; -import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; +import org.opendaylight.transportpce.nbinotifications.utils.TopicManager; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationService; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.slf4j.Logger; @@ -36,30 +38,39 @@ public class NbiNotificationsProvider { private final NotificationService notificationService; private final JsonStringConverter converterService; private final JsonStringConverter converterAlarmService; + private final JsonStringConverter converterTapiService; private final String subscriberServer; private ObjectRegistration rpcRegistration; private ListenerRegistration listenerRegistration; + private TopicManager topicManager = TopicManager.getInstance(); + private final NetworkTransactionService networkTransactionService; public NbiNotificationsProvider(List publishersService, List publishersAlarm, - String subscriberServer, String publisherServer, - RpcProviderService rpcProviderService, NotificationService notificationService, - BindingDOMCodecServices bindingDOMCodecServices) { + String subscriberServer, String publisherServer, + RpcProviderService rpcProviderService, NotificationService notificationService, + BindingDOMCodecServices bindingDOMCodecServices, + NetworkTransactionService networkTransactionService) { this.rpcService = rpcProviderService; this.notificationService = notificationService; + this.topicManager.setPublisherServer(publisherServer); converterService = new JsonStringConverter<>(bindingDOMCodecServices); + this.topicManager.setProcessConverter(converterService); for (String publisherService: publishersService) { LOG.info("Creating publisher for the following class {}", publisherService); - publishersServiceMap.put(publisherService, new Publisher<>(publisherService, publisherServer, - converterService, NotificationServiceSerializer.class)); + this.topicManager.addProcessTopic(publisherService); } converterAlarmService = new JsonStringConverter<>(bindingDOMCodecServices); + this.topicManager.setAlarmConverter(converterAlarmService); for (String publisherAlarm: publishersAlarm) { LOG.info("Creating publisher for the following class {}", publisherAlarm); - publishersAlarmMap.put(publisherAlarm, new Publisher<>(publisherAlarm, publisherServer, - converterAlarmService, NotificationAlarmServiceSerializer.class)); + this.topicManager.addAlarmTopic(publisherAlarm); } this.subscriberServer = subscriberServer; + converterTapiService = new JsonStringConverter<>(bindingDOMCodecServices); + LOG.info("baozhi tapi converter: {}", converterTapiService); + this.topicManager.setTapiConverter(converterTapiService); + this.networkTransactionService = networkTransactionService; } /** @@ -67,10 +78,15 @@ public class NbiNotificationsProvider { */ public void init() { LOG.info("NbiNotificationsProvider Session Initiated"); - rpcRegistration = rpcService.registerRpcImplementation(NbiNotificationsService.class, - new NbiNotificationsImpl(converterService, converterAlarmService, subscriberServer)); - listenerRegistration = notificationService.registerNotificationListener( - new NbiNotificationsListenerImpl(publishersServiceMap, publishersAlarmMap)); + NbiNotificationsImpl nbiImpl = new NbiNotificationsImpl(converterService, converterAlarmService, + converterTapiService, subscriberServer, this.networkTransactionService, this.topicManager); + rpcRegistration = rpcService.registerRpcImplementation(NbiNotificationsService.class, nbiImpl); + rpcService.registerRpcImplementation(TapiNotificationService.class, nbiImpl); + NbiNotificationsListenerImpl nbiNotificationsListener = + new NbiNotificationsListenerImpl(this.topicManager.getProcessTopicMap(), + this.topicManager.getAlarmTopicMap(), this.topicManager.getTapiTopicMap()); + listenerRegistration = notificationService.registerNotificationListener(nbiNotificationsListener); + this.topicManager.setNbiNotificationsListener(nbiNotificationsListener); } /** diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java index 37b4c0181..797fca719 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImpl.java @@ -7,27 +7,48 @@ */ package org.opendaylight.transportpce.nbinotifications.listener; +import java.util.HashMap; import java.util.Map; import org.opendaylight.transportpce.nbinotifications.producer.Publisher; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NbiNotificationsListener; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NbiNotificationsListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfo; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfoBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfoKey; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AlarmInfoBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributes; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributesBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.ChangedAttributesKey; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectName; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectNameBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TargetObjectNameKey; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.TcaInfoBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class NbiNotificationsListenerImpl implements NbiNotificationsListener { private static final Logger LOG = LoggerFactory.getLogger(NbiNotificationsListenerImpl.class); - private final Map> publishersServiceMap; - private final Map> publishersAlarmMap; + private Map> publishersServiceMap; + private Map> publishersAlarmMap; + private Map> tapiPublisherMap; public NbiNotificationsListenerImpl(Map> publishersServiceMap, - Map> publishersAlarmMap) { + Map> publishersAlarmMap, + Map> tapiPublisherMap) { this.publishersServiceMap = publishersServiceMap; this.publishersAlarmMap = publishersAlarmMap; + this.tapiPublisherMap = tapiPublisherMap; } @Override @@ -67,4 +88,85 @@ public class NbiNotificationsListenerImpl implements NbiNotificationsListener { .setServiceName(notification.getServiceName()) .build(), "alarm" + notification.getConnectionType().getName()); } + + @Override + public void onPublishTapiNotificationService(PublishTapiNotificationService notification) { + LOG.info("Receiving request for publishing TAPI notification"); + String topic = notification.getTopic(); + if (!tapiPublisherMap.containsKey(topic)) { + LOG.error("Unknown topic {}", topic); + return; + } + Publisher publisher = tapiPublisherMap.get(topic); + publisher.sendEvent(new NotificationTapiServiceBuilder(transformTapiNotification(notification)) + .build(), topic); + } + + private NotificationTapiService transformTapiNotification(PublishTapiNotificationService notification) { + Map addInfoMap = new HashMap<>(); + if (notification.getAdditionalInfo() != null) { + for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.AdditionalInfo + addInfo:notification.getAdditionalInfo().values()) { + AdditionalInfo transAddInfo = new AdditionalInfoBuilder(addInfo).build(); + addInfoMap.put(transAddInfo.key(), transAddInfo); + } + } + Map changedAttMap = new HashMap<>(); + if (notification.getChangedAttributes() != null) { + for (org.opendaylight.yang.gen.v1 + .urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes + changedAtt:notification.getChangedAttributes().values()) { + ChangedAttributes transChangedAtt = new ChangedAttributesBuilder(changedAtt).build(); + changedAttMap.put(transChangedAtt.key(), transChangedAtt); + } + } + Map nameMap = new HashMap<>(); + if (notification.getName() != null) { + for (Name name:notification.getName().values()) { + Name transName = new NameBuilder(name).build(); + nameMap.put(transName.key(), transName); + } + } + Map targetObjNameMap = new HashMap<>(); + if (notification.getTargetObjectName() != null) { + for (org.opendaylight.yang.gen.v1 + .urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName + targetObjectName:notification.getTargetObjectName().values()) { + TargetObjectName transTargetObjName = new TargetObjectNameBuilder(targetObjectName).build(); + targetObjNameMap.put(transTargetObjName.key(), transTargetObjName); + } + } + LOG.info("Notification uuid = {}", notification.getUuid()); + return new NotificationTapiServiceBuilder() + .setAlarmInfo(notification.getAlarmInfo() == null ? null + : new AlarmInfoBuilder(notification.getAlarmInfo()).build()) + .setAdditionalText(notification.getAdditionalText()) + .setAdditionalInfo(addInfoMap) + .setNotificationType(notification.getNotificationType()) + .setChangedAttributes(changedAttMap) + .setEventTimeStamp(notification.getEventTimeStamp()) + .setLayerProtocolName(notification.getLayerProtocolName()) + .setName(nameMap) + .setSequenceNumber(notification.getSequenceNumber()) + .setSourceIndicator(notification.getSourceIndicator()) + .setTargetObjectIdentifier(notification.getTargetObjectIdentifier()) + .setTargetObjectName(targetObjNameMap) + .setTargetObjectType(notification.getTargetObjectType()) + .setTcaInfo(notification.getTcaInfo() == null ? null + : new TcaInfoBuilder(notification.getTcaInfo()).build()) + .setUuid(notification.getUuid()) + .build(); + } + + public void setPublishersServiceMap(Map> publishersServiceMap) { + this.publishersServiceMap = publishersServiceMap; + } + + public void setPublishersAlarmMap(Map> publishersAlarmMap) { + this.publishersAlarmMap = publishersAlarmMap; + } + + public void setTapiPublishersMap(Map> tapiPublishersMap) { + this.tapiPublisherMap = tapiPublishersMap; + } } diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializer.java index c08dbfb2f..4f0d19fca 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializer.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializer.java @@ -11,9 +11,9 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import org.apache.kafka.common.serialization.Deserializer; import org.opendaylight.transportpce.common.converter.JsonStringConverter; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.slf4j.Logger; diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializer.java index 9d0371a12..9816d9f6f 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializer.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializer.java @@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import org.apache.kafka.common.serialization.Serializer; import org.opendaylight.transportpce.common.converter.JsonStringConverter; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.slf4j.Logger; diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializer.java index eab7f3618..73e979310 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializer.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializer.java @@ -11,9 +11,9 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import org.apache.kafka.common.serialization.Deserializer; import org.opendaylight.transportpce.common.converter.JsonStringConverter; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessServiceBuilder; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.slf4j.Logger; diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java index dc2c3d775..8090ccd26 100644 --- a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializer.java @@ -12,7 +12,7 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import org.apache.kafka.common.serialization.Serializer; import org.opendaylight.transportpce.common.converter.JsonStringConverter; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.slf4j.Logger; diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationDeserializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationDeserializer.java new file mode 100644 index 000000000..c4317f34d --- /dev/null +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationDeserializer.java @@ -0,0 +1,132 @@ +/* + * Copyright © 2021 Nokia, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.transportpce.nbinotifications.serialization; + +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import org.apache.kafka.common.serialization.Deserializer; +import org.opendaylight.transportpce.common.converter.JsonStringConverter; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.Notification; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.NotificationBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.AdditionalInfo; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.AdditionalInfoBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.AdditionalInfoKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.AlarmInfoBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TcaInfoBuilder; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TapiNotificationDeserializer implements Deserializer { + private static final Logger LOG = LoggerFactory.getLogger(TapiNotificationDeserializer.class); + private JsonStringConverter converter; + + @SuppressWarnings("unchecked") + @Override + public void configure(Map configs, boolean isKey) { + LOG.info("Tapi Deserializer configuration {}", configs); + if (configs.containsKey(ConfigConstants.CONVERTER) + && configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter) { + converter = (JsonStringConverter) configs.get(ConfigConstants.CONVERTER); + } + } + + @Override + public Notification deserialize(String topic, byte[] data) { + if (converter == null) { + throw new IllegalArgumentException( + "Converter should be configured through configure method of deserializer"); + } + String value = new String(data, StandardCharsets.UTF_8); + // The message published is + // org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService + // we have to map it to + // org.opendaylight.yang.gen.v1 + // .urn.onf.otcc.yang.tapi.notification.rev181210.get.notification.list.output.Notification + NotificationTapiService mappedString = converter.createDataObjectFromJsonString( + YangInstanceIdentifier.of(NotificationTapiService.QNAME), value, JSONCodecFactorySupplier.RFC7951); + if (mappedString == null) { + return null; + } + LOG.info("Reading Tapi event {}", mappedString); + return transformNotificationTapiService(mappedString); + } + + private Notification transformNotificationTapiService(NotificationTapiService mappedString) { + LOG.info("Transforming TAPI notification for getNotificationList rpc"); + Map addInfoMap = new HashMap<>(); + if (mappedString.getAdditionalInfo() != null) { + for (org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.tapi.service.AdditionalInfo + addInfo:mappedString.getAdditionalInfo().values()) { + AdditionalInfo transAddInfo = new AdditionalInfoBuilder() + .setValue(addInfo.getValue()) + .setValueName(addInfo.getValueName()) + .build(); + addInfoMap.put(transAddInfo.key(), transAddInfo); + } + } + Map changedAttMap = new HashMap<>(); + if (mappedString.getChangedAttributes() != null) { + for (org.opendaylight.yang.gen.v1 + .nbi.notifications.rev211013.notification.tapi.service.ChangedAttributes changedAtt:mappedString + .getChangedAttributes().values()) { + ChangedAttributes transChangedAtt = new ChangedAttributesBuilder(changedAtt).build(); + changedAttMap.put(transChangedAtt.key(), transChangedAtt); + } + } + Map nameMap = new HashMap<>(); + if (mappedString.getName() != null) { + for (Name name:mappedString.getName().values()) { + Name transName = new NameBuilder(name).build(); + nameMap.put(transName.key(), transName); + } + } + Map targetObjNameMap = new HashMap<>(); + if (mappedString.getTargetObjectName() != null) { + for (org.opendaylight.yang.gen.v1 + .nbi.notifications.rev211013.notification.tapi.service.TargetObjectName + targetObjectName:mappedString.getTargetObjectName().values()) { + TargetObjectName transTargetObjName = new TargetObjectNameBuilder(targetObjectName).build(); + targetObjNameMap.put(transTargetObjName.key(), transTargetObjName); + } + } + LOG.info("Notification uuid = {}", mappedString.getUuid().getValue()); + return new NotificationBuilder() + .setAlarmInfo(mappedString.getAlarmInfo() == null ? null + : new AlarmInfoBuilder(mappedString.getAlarmInfo()).build()) + .setAdditionalText(mappedString.getAdditionalText()) + .setAdditionalInfo(addInfoMap) + .setNotificationType(mappedString.getNotificationType()) + .setChangedAttributes(changedAttMap) + .setEventTimeStamp(mappedString.getEventTimeStamp()) + .setLayerProtocolName(mappedString.getLayerProtocolName()) + .setName(nameMap) + .setSequenceNumber(mappedString.getSequenceNumber()) + .setSourceIndicator(mappedString.getSourceIndicator()) + .setTargetObjectIdentifier(mappedString.getTargetObjectIdentifier()) + .setTargetObjectName(targetObjNameMap) + .setTargetObjectType(mappedString.getTargetObjectType()) + .setTcaInfo(mappedString.getTcaInfo() == null ? null + : new TcaInfoBuilder(mappedString.getTcaInfo()).build()) + .setUuid(mappedString.getUuid()) + .build(); + } +} + diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationSerializer.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationSerializer.java new file mode 100644 index 000000000..7525fcfec --- /dev/null +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/serialization/TapiNotificationSerializer.java @@ -0,0 +1,56 @@ +/* + * Copyright © 2021 Nokia, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.transportpce.nbinotifications.serialization; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import org.apache.kafka.common.serialization.Serializer; +import org.opendaylight.transportpce.common.converter.JsonStringConverter; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TapiNotificationSerializer implements Serializer { + private static final Logger LOG = LoggerFactory.getLogger(TapiNotificationSerializer.class); + private JsonStringConverter converter; + + @SuppressWarnings("unchecked") + @Override + public void configure(Map configs, boolean isKey) { + LOG.info("Deserializer configuration {}", configs); + if (configs.containsKey(ConfigConstants.CONVERTER) + && configs.get(ConfigConstants.CONVERTER) instanceof JsonStringConverter) { + converter = (JsonStringConverter) configs.get(ConfigConstants.CONVERTER); + } + } + + @Override + public byte[] serialize(String topic, NotificationTapiService data) { + if (converter == null) { + throw new IllegalArgumentException( + "Converter should be configured through configure method of serializer"); + } + if (data == null) { + LOG.error("Notification data is empty"); + return new byte[0]; + } + try { + InstanceIdentifier iid = InstanceIdentifier.builder(NotificationTapiService.class) + .build(); + String serialized = converter.createJsonStringFromDataObject(iid, data, JSONCodecFactorySupplier.RFC7951); + LOG.info("Serialized event {}", serialized); + return serialized.getBytes(StandardCharsets.UTF_8); + } catch (IOException e) { + LOG.error("Event couldnt be serialized", e); + return new byte[0]; + } + } +} diff --git a/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/TopicManager.java b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/TopicManager.java new file mode 100644 index 000000000..ea596de38 --- /dev/null +++ b/nbinotifications/src/main/java/org/opendaylight/transportpce/nbinotifications/utils/TopicManager.java @@ -0,0 +1,121 @@ +/* + * Copyright © 2021 Nokia, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.transportpce.nbinotifications.utils; + +import java.util.HashMap; +import java.util.Map; +import org.opendaylight.transportpce.common.converter.JsonStringConverter; +import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl; +import org.opendaylight.transportpce.nbinotifications.producer.Publisher; +import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer; +import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer; +import org.opendaylight.transportpce.nbinotifications.serialization.TapiNotificationSerializer; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class TopicManager { + + private static final Logger LOG = LoggerFactory.getLogger(TopicManager.class); + private static TopicManager instance = new TopicManager(); + + private Map> tapiPublisherMap = new HashMap<>(); + private String publisherServer; + private JsonStringConverter tapiConverter; + private NbiNotificationsListenerImpl nbiNotificationsListener; + private Map> alarmPublisherMap = new HashMap<>(); + private Map> processPublisherMap = new HashMap<>(); + private JsonStringConverter processConverter; + private JsonStringConverter alarmConverter; + private int calledSetConverter = 0; + + private TopicManager() { + } + + public static TopicManager getInstance() { + return instance; + } + + public void setNbiNotificationsListener(NbiNotificationsListenerImpl nbiNotificationsListener) { + this.nbiNotificationsListener = nbiNotificationsListener; + } + + public void setProcessConverter(JsonStringConverter processConverter) { + this.processConverter = processConverter; + } + + public void setAlarmConverter(JsonStringConverter alarmConverter) { + this.alarmConverter = alarmConverter; + } + + public void setTapiConverter(JsonStringConverter tapiConverter) { + this.tapiConverter = tapiConverter; + this.calledSetConverter++; + } + + public void setPublisherServer(String publisherServer) { + this.publisherServer = publisherServer; + } + + public void addProcessTopic(String topic) { + LOG.info("Adding process topic: {}", topic); + processPublisherMap.put(topic, new Publisher<>(topic, publisherServer, processConverter, + NotificationServiceSerializer.class)); + if (this.nbiNotificationsListener != null) { + this.nbiNotificationsListener.setPublishersServiceMap(processPublisherMap); + } + } + + public void addAlarmTopic(String topic) { + LOG.info("Adding alarm topic: {}", topic); + alarmPublisherMap.put(topic, new Publisher<>(topic, publisherServer, alarmConverter, + NotificationAlarmServiceSerializer.class)); + if (this.nbiNotificationsListener != null) { + this.nbiNotificationsListener.setPublishersAlarmMap(alarmPublisherMap); + } + } + + public void addTapiTopic(String topic) { + if (tapiPublisherMap.containsKey(topic)) { + LOG.info("Tapi topic: {} already exists", topic); + return; + } + LOG.info("Adding new tapi topic: {}", topic); + tapiPublisherMap.put(topic, new Publisher<>(topic, publisherServer, tapiConverter, + TapiNotificationSerializer.class)); + if (this.nbiNotificationsListener != null) { + this.nbiNotificationsListener.setTapiPublishersMap(tapiPublisherMap); + } + } + + public void deleteTapiTopic(String topic) { + if (!tapiPublisherMap.containsKey(topic)) { + LOG.info("Tapi topic: {} doesnt exist", topic); + return; + } + LOG.info("Deleting tapi topic: {}", topic); + tapiPublisherMap.remove(topic); + if (this.nbiNotificationsListener != null) { + this.nbiNotificationsListener.setTapiPublishersMap(tapiPublisherMap); + } + } + + public Map> getTapiTopicMap() { + return this.tapiPublisherMap; + } + + public Map> getAlarmTopicMap() { + return this.alarmPublisherMap; + } + + public Map> getProcessTopicMap() { + return this.processPublisherMap; + } +} diff --git a/nbinotifications/src/main/resources/OSGI-INF/blueprint/nobinotifications-blueprint.xml b/nbinotifications/src/main/resources/OSGI-INF/blueprint/nobinotifications-blueprint.xml index d938b9d28..39bb0c041 100644 --- a/nbinotifications/src/main/resources/OSGI-INF/blueprint/nobinotifications-blueprint.xml +++ b/nbinotifications/src/main/resources/OSGI-INF/blueprint/nobinotifications-blueprint.xml @@ -15,6 +15,8 @@ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" + @@ -36,5 +38,6 @@ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" + diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/consumer/SubscriberTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/consumer/SubscriberTest.java index 7e5fcf615..c32142f23 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/consumer/SubscriberTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/consumer/SubscriberTest.java @@ -22,10 +22,10 @@ import org.junit.Before; import org.junit.Test; import org.opendaylight.transportpce.nbinotifications.utils.NotificationServiceDataUtils; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService; public class SubscriberTest extends AbstractTest { private static final String TOPIC = "topic"; diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImplTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImplTest.java index 825193f01..018c2d622 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImplTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsImplTest.java @@ -13,27 +13,43 @@ import com.google.common.util.concurrent.ListenableFuture; import java.util.concurrent.ExecutionException; import org.junit.Before; import org.junit.Test; +import org.mockito.Mock; import org.opendaylight.transportpce.common.converter.JsonStringConverter; +import org.opendaylight.transportpce.common.network.NetworkTransactionImpl; +import org.opendaylight.transportpce.common.network.NetworkTransactionService; +import org.opendaylight.transportpce.common.network.RequestProcessor; +import org.opendaylight.transportpce.nbinotifications.utils.TopicManager; import org.opendaylight.transportpce.test.AbstractTest; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceInputBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsAlarmServiceOutput; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceInputBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.GetNotificationsProcessServiceOutput; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceInputBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsAlarmServiceOutput; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceInputBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.GetNotificationsProcessServiceOutput; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationTapiService; import org.opendaylight.yangtools.yang.common.RpcResult; public class NbiNotificationsImplTest extends AbstractTest { private NbiNotificationsImpl nbiNotificationsImpl; + public static NetworkTransactionService networkTransactionService; + + @Mock + private TopicManager topicManager; @Before public void setUp() { + networkTransactionService = new NetworkTransactionImpl( + new RequestProcessor(getDataStoreContextUtil().getDataBroker())); JsonStringConverter converter = new JsonStringConverter<>( getDataStoreContextUtil().getBindingDOMCodecServices()); JsonStringConverter converterAlarm = new JsonStringConverter<>( getDataStoreContextUtil().getBindingDOMCodecServices()); - nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm,"localhost:8080"); + JsonStringConverter converterTapi = new JsonStringConverter<>( + getDataStoreContextUtil().getBindingDOMCodecServices()); + + nbiNotificationsImpl = new NbiNotificationsImpl(converter, converterAlarm, converterTapi, + "localhost:8080", networkTransactionService, topicManager); } @Test diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProviderTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProviderTest.java index 2b917aab0..93827286f 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProviderTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/impl/NbiNotificationsProviderTest.java @@ -18,10 +18,14 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.api.RpcProviderService; +import org.opendaylight.transportpce.common.network.NetworkTransactionImpl; +import org.opendaylight.transportpce.common.network.NetworkTransactionService; +import org.opendaylight.transportpce.common.network.RequestProcessor; import org.opendaylight.transportpce.nbinotifications.listener.NbiNotificationsListenerImpl; import org.opendaylight.transportpce.test.AbstractTest; public class NbiNotificationsProviderTest extends AbstractTest { + public static NetworkTransactionService networkTransactionService; @Mock RpcProviderService rpcProviderRegistry; @@ -37,12 +41,14 @@ public class NbiNotificationsProviderTest extends AbstractTest { @Test public void initTest() { + networkTransactionService = new NetworkTransactionImpl( + new RequestProcessor(getDataStoreContextUtil().getDataBroker())); NbiNotificationsProvider provider = new NbiNotificationsProvider( Arrays.asList("topic1", "topic2"), Arrays.asList("topic1", "topic2"), "localhost:8080", "localhost:8080", rpcProviderRegistry, notificationService, - getDataStoreContextUtil().getBindingDOMCodecServices()); + getDataStoreContextUtil().getBindingDOMCodecServices(), networkTransactionService); provider.init(); - verify(rpcProviderRegistry, times(1)) + verify(rpcProviderRegistry, times(2)) .registerRpcImplementation(any(), any(NbiNotificationsImpl.class)); verify(notificationService, times(1)) .registerNotificationListener(any(NbiNotificationsListenerImpl.class)); diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImplTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImplTest.java index c0fa4d1ba..1743723e6 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImplTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/listener/NbiNotificationsListenerImplTest.java @@ -12,6 +12,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import java.util.HashMap; import java.util.Map; import org.junit.Before; import org.junit.Test; @@ -21,12 +22,12 @@ import org.opendaylight.transportpce.nbinotifications.producer.Publisher; import org.opendaylight.transportpce.test.AbstractTest; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder; public class NbiNotificationsListenerImplTest extends AbstractTest { @Mock @@ -42,7 +43,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest { @Test public void onPublishNotificationServiceTest() { NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService), - Map.of("test", publisherAlarm)); + Map.of("test", publisherAlarm), new HashMap<>()); PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder() .setPublisherName("test") .setCommonId("commonId") @@ -58,7 +59,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest { @Test public void onPublishNotificationServiceWrongPublisherTest() { NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService), - Map.of("test", publisherAlarm)); + Map.of("test", publisherAlarm), new HashMap<>()); PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder() .setPublisherName("wrongPublisher") .setCommonId("commonId") @@ -74,7 +75,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest { @Test public void onPublishNotificationAlarmServiceTest() { NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService), - Map.of("test", publisherAlarm)); + Map.of("test", publisherAlarm), new HashMap<>()); PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder() .setPublisherName("test") .setConnectionType(ConnectionType.Service) @@ -89,7 +90,7 @@ public class NbiNotificationsListenerImplTest extends AbstractTest { @Test public void onPublishNotificationAlarmServiceWrongPublisherTest() { NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService), - Map.of("test", publisherAlarm)); + Map.of("test", publisherAlarm), new HashMap<>()); PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder() .setPublisherName("wrongPublisher") .setConnectionType(ConnectionType.Service) diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/producer/PublisherTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/producer/PublisherTest.java index 4b9e160f5..1d988fc0c 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/producer/PublisherTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/producer/PublisherTest.java @@ -22,8 +22,8 @@ import org.opendaylight.transportpce.nbinotifications.serialization.ConfigConsta import org.opendaylight.transportpce.nbinotifications.serialization.NotificationAlarmServiceSerializer; import org.opendaylight.transportpce.nbinotifications.serialization.NotificationServiceSerializer; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializerTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializerTest.java index b0d156a2a..d1c5c39a4 100755 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializerTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceDeserializerTest.java @@ -16,8 +16,8 @@ import java.util.Map; import org.junit.Test; import org.opendaylight.transportpce.common.converter.JsonStringConverter; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService; public class NotificationAlarmServiceDeserializerTest extends AbstractTest { diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializerTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializerTest.java index 605c85158..b850f5b79 100755 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializerTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationAlarmServiceSerializerTest.java @@ -20,7 +20,7 @@ import java.util.Map; import org.junit.Test; import org.opendaylight.transportpce.common.converter.JsonStringConverter; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationAlarmService; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializerTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializerTest.java index 12f7a80f3..0c47b49bc 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializerTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceDeserializerTest.java @@ -16,8 +16,8 @@ import java.util.Map; import org.junit.Test; import org.opendaylight.transportpce.common.converter.JsonStringConverter; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService; public class NotificationServiceDeserializerTest extends AbstractTest { diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializerTest.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializerTest.java index 4a4868bbd..51d83fa14 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializerTest.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/serialization/NotificationServiceSerializerTest.java @@ -20,7 +20,7 @@ import java.util.Map; import org.junit.Test; import org.opendaylight.transportpce.common.converter.JsonStringConverter; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; diff --git a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/utils/NotificationServiceDataUtils.java b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/utils/NotificationServiceDataUtils.java index de4cb5f01..ea8c5496a 100644 --- a/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/utils/NotificationServiceDataUtils.java +++ b/nbinotifications/src/test/java/org/opendaylight/transportpce/nbinotifications/utils/NotificationServiceDataUtils.java @@ -20,14 +20,14 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.port.PortBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.NotificationProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.get.notifications.process.service.output.NotificationsProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.NotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.alarm.service.output.NotificationsAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.get.notifications.process.service.output.NotificationsProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint8; diff --git a/nbinotifications/src/test/resources/expected_event.json b/nbinotifications/src/test/resources/expected_event.json index 47209dd7d..4e277d8a5 100644 --- a/nbinotifications/src/test/resources/expected_event.json +++ b/nbinotifications/src/test/resources/expected_event.json @@ -1,104 +1,104 @@ { "nbi-notifications:notification-process-service": { - "common-id": "commond-id", - "message": "message", - "operational-state": "inService", + "connection-type": "service", "service-z-end": { - "node-id": "XPONDER-1-2", - "service-rate": 1, - "clli": "clli", - "is-split-lambda": false, - "service-format": "OC", "tx-direction": [ { "index": 0, + "lgx": { + "lgx-port-rack": "lgx port rack", + "lgx-device-name": "lgx device name", + "lgx-port-shelf": "lgx port shelf", + "lgx-port-name": "lgx port name" + }, "port": { - "port-name": "port name", - "port-slot": "port slot", + "port-type": "port type", "port-sub-slot": "port subslot", + "port-name": "port name", + "port-rack": "port rack", "port-device-name": "device name", - "port-shelf": "port shelf", - "port-type": "port type", - "port-rack": "port rack" - }, - "lgx": { - "lgx-port-shelf": "lgx port shelf", - "lgx-port-rack": "lgx port rack", - "lgx-port-name": "lgx port name", - "lgx-device-name": "lgx device name" + "port-slot": "port slot", + "port-shelf": "port shelf" } } ], + "node-id": "XPONDER-1-2", + "service-format": "OC", + "service-rate": 1, "rx-direction": [ { "index": 0, + "lgx": { + "lgx-port-rack": "lgx port rack", + "lgx-device-name": "lgx device name", + "lgx-port-shelf": "lgx port shelf", + "lgx-port-name": "lgx port name" + }, "port": { - "port-name": "port name", - "port-slot": "port slot", + "port-type": "port type", "port-sub-slot": "port subslot", + "port-name": "port name", + "port-rack": "port rack", "port-device-name": "device name", - "port-shelf": "port shelf", - "port-type": "port type", - "port-rack": "port rack" - }, - "lgx": { - "lgx-port-shelf": "lgx port shelf", - "lgx-port-rack": "lgx port rack", - "lgx-port-name": "lgx port name", - "lgx-device-name": "lgx device name" + "port-slot": "port slot", + "port-shelf": "port shelf" } } - ] + ], + "is-split-lambda": false, + "clli": "clli" }, - "service-name": "service1", - "connection-type": "service", + "message": "message", "service-a-end": { - "node-id": "XPONDER-1-2", - "service-rate": 1, - "clli": "clli", - "is-split-lambda": false, - "service-format": "OC", "tx-direction": [ { "index": 0, + "lgx": { + "lgx-port-rack": "lgx port rack", + "lgx-device-name": "lgx device name", + "lgx-port-shelf": "lgx port shelf", + "lgx-port-name": "lgx port name" + }, "port": { - "port-name": "port name", - "port-slot": "port slot", + "port-type": "port type", "port-sub-slot": "port subslot", + "port-name": "port name", + "port-rack": "port rack", "port-device-name": "device name", - "port-shelf": "port shelf", - "port-type": "port type", - "port-rack": "port rack" - }, - "lgx": { - "lgx-port-shelf": "lgx port shelf", - "lgx-port-rack": "lgx port rack", - "lgx-port-name": "lgx port name", - "lgx-device-name": "lgx device name" + "port-slot": "port slot", + "port-shelf": "port shelf" } } ], + "node-id": "XPONDER-1-2", + "service-format": "OC", + "service-rate": 1, "rx-direction": [ { "index": 0, + "lgx": { + "lgx-port-rack": "lgx port rack", + "lgx-device-name": "lgx device name", + "lgx-port-shelf": "lgx port shelf", + "lgx-port-name": "lgx port name" + }, "port": { - "port-name": "port name", - "port-slot": "port slot", + "port-type": "port type", "port-sub-slot": "port subslot", + "port-name": "port name", + "port-rack": "port rack", "port-device-name": "device name", - "port-shelf": "port shelf", - "port-type": "port type", - "port-rack": "port rack" - }, - "lgx": { - "lgx-port-shelf": "lgx port shelf", - "lgx-port-rack": "lgx port rack", - "lgx-port-name": "lgx port name", - "lgx-device-name": "lgx device name" + "port-slot": "port slot", + "port-shelf": "port shelf" } } - ] + ], + "is-split-lambda": false, + "clli": "clli" }, - "response-failed": "" + "operational-state": "inService", + "common-id": "commond-id", + "response-failed": "", + "service-name": "service1" } -} +} \ No newline at end of file diff --git a/nbinotifications/src/test/resources/expected_event_alarm_service.json b/nbinotifications/src/test/resources/expected_event_alarm_service.json index 68480455f..4b71fd0d8 100755 --- a/nbinotifications/src/test/resources/expected_event_alarm_service.json +++ b/nbinotifications/src/test/resources/expected_event_alarm_service.json @@ -1,8 +1,8 @@ { "nbi-notifications:notification-alarm-service": { + "connection-type": "service", "message": "The service is now inService", - "operational-state": "inService", "service-name": "service1", - "connection-type": "service" + "operational-state": "inService" } } \ No newline at end of file diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkModelProvider.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkModelProvider.java index f1c56764f..0abee0753 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkModelProvider.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkModelProvider.java @@ -19,7 +19,7 @@ import org.opendaylight.transportpce.networkmodel.listeners.PortMappingListener; import org.opendaylight.transportpce.networkmodel.listeners.ServiceHandlerListener; import org.opendaylight.transportpce.networkmodel.service.FrequenciesService; import org.opendaylight.transportpce.networkmodel.util.TpceNetwork; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.TransportpceNetworkutilsService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.TransportpceNetworkutilsService; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.Network; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkUtilsImpl.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkUtilsImpl.java index 1d799ada4..b954aa37e 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkUtilsImpl.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/NetworkUtilsImpl.java @@ -15,19 +15,19 @@ import org.opendaylight.mdsal.binding.api.ReadTransaction; import org.opendaylight.mdsal.binding.api.WriteTransaction; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.NetworkUtils; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.DeleteLinkInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.DeleteLinkOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.DeleteLinkOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRdmXpdrLinksInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRdmXpdrLinksOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRdmXpdrLinksOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRoadmNodesInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRoadmNodesOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRoadmNodesOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitXpdrRdmLinksInput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitXpdrRdmLinksOutput; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitXpdrRdmLinksOutputBuilder; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.TransportpceNetworkutilsService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.DeleteLinkInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.DeleteLinkOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.DeleteLinkOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRdmXpdrLinksInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRdmXpdrLinksOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRdmXpdrLinksOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRoadmNodesInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRoadmNodesOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRoadmNodesOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitXpdrRdmLinksInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitXpdrRdmLinksOutput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitXpdrRdmLinksOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.TransportpceNetworkutilsService; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/OrdLink.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/OrdLink.java index ba108903f..26c8f4b6d 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/OrdLink.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/OrdLink.java @@ -19,7 +19,7 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.networkmodel.util.LinkIdUtil; import org.opendaylight.transportpce.networkmodel.util.TopologyUtils; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRoadmNodesInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRoadmNodesInput; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1Builder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java index 6c05f8a66..a40e55bbd 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/R2RLinkDiscovery.java @@ -25,7 +25,7 @@ import org.opendaylight.transportpce.common.Timeouts; import org.opendaylight.transportpce.common.device.DeviceTransactionManager; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.networkmodel.util.TopologyUtils; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRoadmNodesInputBuilder; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRoadmNodesInputBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.Network; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.cp.to.degree.CpToDegree; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/Rdm2XpdrLink.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/Rdm2XpdrLink.java index 8f1268838..1a518514c 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/Rdm2XpdrLink.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/Rdm2XpdrLink.java @@ -21,7 +21,7 @@ import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.networkmodel.util.LinkIdUtil; import org.opendaylight.transportpce.networkmodel.util.TopologyUtils; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.links.input.grouping.LinksInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.links.input.grouping.LinksInput; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1Builder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java index a0f506ae6..dbbf0aaaf 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelService.java @@ -8,9 +8,9 @@ package org.opendaylight.transportpce.networkmodel.service; import java.util.List; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.renderer.rpc.result.sp.Link; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNodeConnectionStatus; import org.opendaylight.yangtools.yang.common.Uint32; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java index c9ddfe112..e71c5dc52 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/service/NetworkModelServiceImpl.java @@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmo import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.topology.update.result.TopologyChanges; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.topology.update.result.TopologyChangesBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkmodel.rev201116.topology.update.result.TopologyChangesKey; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.OpenroadmNodeVersion; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.nodes.NodeInfo; @@ -46,7 +47,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.otn.network.topology.rev211210.TerminationPoint1; import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTp; import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTpBuilder; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/LinkIdUtil.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/LinkIdUtil.java index 22742cfe4..5e8bf12ec 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/LinkIdUtil.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/LinkIdUtil.java @@ -8,7 +8,7 @@ package org.opendaylight.transportpce.networkmodel.util; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.InitRoadmNodesInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.InitRoadmNodesInput; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId; diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java index 58824cc50..9843bd987 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopology.java @@ -20,6 +20,7 @@ import org.eclipse.jdt.annotation.Nullable; import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.networkmodel.dto.OtnTopoNode; import org.opendaylight.transportpce.networkmodel.dto.TopologyShard; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; @@ -59,7 +60,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.Supp import org.opendaylight.yang.gen.v1.http.org.openroadm.switching.pool.types.rev191129.SwitchingPoolTypes; import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev211210.xpdr.otn.tp.attributes.OdtuTpnPool; import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev211210.xpdr.otn.tp.attributes.OdtuTpnPoolBuilder; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node; @@ -298,12 +298,14 @@ public final class OpenRoadmOtnTopology { for (Link link : suppOtuLinks) { if (link.augmentation(Link1.class) == null || link.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1.class) == null) { + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630 + .Link1.class) == null) { LOG.error(OTN_PARAMS_ERROR, link.getLinkId().getValue()); return new TopologyShard(null, null, null); } OtnLinkType otnLinkType = link.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1.class).getOtnLinkType(); + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.Link1.class) + .getOtnLinkType(); if (!OTNLINKTYPE_OTU_BW_MAP.containsKey(otnLinkType)) { //TODO shouldn't other link type listed in OTNLINKTYPE_BW_MAP be handled too ? LOG.warn("Unexpected otn-link-type {} for link {}", otnLinkType, link.getLinkId()); @@ -327,8 +329,8 @@ public final class OpenRoadmOtnTopology { List links = new ArrayList<>(); String nodeATopo = formatNodeName(nodeA, tpA); String nodeZTopo = formatNodeName(nodeZ, tpZ); - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1 tpceLink1 - = new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1Builder() + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.Link1 tpceLink1 + = new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.Link1Builder() .setOtnLinkType(linkType).build(); Link1Builder otnLink1Bldr = new Link1Builder() .setUsedBandwidth(Uint32.valueOf(0)); @@ -737,20 +739,20 @@ public final class OpenRoadmOtnTopology { new TpId(mapping.getLogicalConnectionPoint()), tpType, otnTp1Bldr.build(), - new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1Builder(), mapping); } } private static void setclientNwTpAttr(Map tpMap, OtnTopoNode node, TpId tpId, - OpenroadmTpType tpType, TerminationPoint1 otnTp1, - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1Builder tpceTp1Bldr, - Mapping mapping) { - + OpenroadmTpType tpType, TerminationPoint1 otnTp1, Mapping mapping) { + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1Builder cnTP1BLdr + = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 + .TerminationPoint1Builder(); switch (tpType) { case XPONDERNETWORK: if (node.getXpdrNetConnectionMap().get(tpId.getValue()) != null) { - tpceTp1Bldr.setAssociatedConnectionMapPort(node.getXpdrNetConnectionMap().get(tpId.getValue())); + cnTP1BLdr.setAssociatedConnectionMapTp(Set.of( + new TpId(node.getXpdrNetConnectionMap().get(tpId.getValue())))); } SupportingTerminationPoint stp = new SupportingTerminationPointBuilder() .setNetworkRef(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID)) @@ -758,14 +760,15 @@ public final class OpenRoadmOtnTopology { .setTpRef(tpId) .build(); TerminationPoint ietfTpNw = - buildIetfTp(tpceTp1Bldr, otnTp1, tpType, tpId, Map.of(stp.key(), stp), mapping); + buildIetfTp(cnTP1BLdr, otnTp1, tpType, tpId, Map.of(stp.key(), stp), mapping); tpMap.put(ietfTpNw.key(),ietfTpNw); break; case XPONDERCLIENT: if (node.getXpdrCliConnectionMap().get(tpId.getValue()) != null) { - tpceTp1Bldr.setAssociatedConnectionMapPort(node.getXpdrCliConnectionMap().get(tpId.getValue())); + cnTP1BLdr.setAssociatedConnectionMapTp(Set.of( + new TpId(node.getXpdrCliConnectionMap().get(tpId.getValue())))); } - TerminationPoint ietfTpCl = buildIetfTp(tpceTp1Bldr, otnTp1, tpType, tpId, null, mapping); + TerminationPoint ietfTpCl = buildIetfTp(cnTP1BLdr, otnTp1, tpType, tpId, null, mapping); tpMap.put(ietfTpCl.key(),ietfTpCl); break; default: @@ -818,14 +821,11 @@ public final class OpenRoadmOtnTopology { } private static TerminationPoint buildIetfTp( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1Builder tpceTp1Bldr, + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1Builder cnTP1BLdr, TerminationPoint1 otnTp1, OpenroadmTpType tpType, TpId tpId, Map supportTpMap, Mapping mapping) { TerminationPointBuilder ietfTpBldr = new TerminationPointBuilder(); - if (tpceTp1Bldr.getAssociatedConnectionMapPort() != null) { - ietfTpBldr.addAugmentation(tpceTp1Bldr.build()); - } if (supportTpMap != null) { ietfTpBldr.setSupportingTerminationPoint(supportTpMap); } @@ -833,13 +833,11 @@ public final class OpenRoadmOtnTopology { .setTpId(tpId) .withKey(new TerminationPointKey(tpId)) .addAugmentation(otnTp1) - .addAugmentation( - new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1Builder() - .setTpType(tpType) + .addAugmentation(cnTP1BLdr.setTpType(tpType) .setAdministrativeState(TopologyUtils.setNetworkAdminState(mapping.getPortAdminState())) .setOperationalState(TopologyUtils.setNetworkOperState(mapping.getPortOperState())) .build()) - .build(); + .build(); } private static String formatNodeName(String nodeName, String tpName) { diff --git a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopology.java b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopology.java index 5384547bd..d53b05567 100644 --- a/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopology.java +++ b/networkmodel/src/main/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopology.java @@ -15,6 +15,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -224,22 +225,19 @@ public final class OpenRoadmTopology { if (isOtn && m.getPortQual().equals("xpdr-client")) { continue; } + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1Builder + ocnTp1Bldr = new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 + .TerminationPoint1Builder() + .setTpType(PORTQUAL_ORD_TYPE_MAP.get(m.getPortQual())) + .setAdministrativeState(TopologyUtils.setNetworkAdminState(m.getPortAdminState())) + .setOperationalState(TopologyUtils.setNetworkOperState(m.getPortOperState())); + if (!isOtn && m.getConnectionMapLcp() != null) { + ocnTp1Bldr.setAssociatedConnectionMapTp(Set.of(new TpId(m.getConnectionMapLcp()))); + } TerminationPointBuilder ietfTpBldr = createTpBldr(m.getLogicalConnectionPoint()) .addAugmentation( // Add openroadm-network-topology tp augmentations - new org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 - .TerminationPoint1Builder() - .setTpType(PORTQUAL_ORD_TYPE_MAP.get(m.getPortQual())) - .setAdministrativeState(TopologyUtils.setNetworkAdminState(m.getPortAdminState())) - .setOperationalState(TopologyUtils.setNetworkOperState(m.getPortOperState())) - .build()); - if (!isOtn) { - ietfTpBldr.addAugmentation( - new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123 - .TerminationPoint1Builder() - .setAssociatedConnectionMapPort(m.getConnectionMapLcp()) - .build()); - } + ocnTp1Bldr.build()); TerminationPoint ietfTp = ietfTpBldr.build(); tpMap.put(ietfTp.key(),ietfTp); } diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/NetworkModelProviderTest.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/NetworkModelProviderTest.java index 2db827b4c..04dec312d 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/NetworkModelProviderTest.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/NetworkModelProviderTest.java @@ -26,7 +26,7 @@ import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.networkmodel.listeners.PortMappingListener; import org.opendaylight.transportpce.networkmodel.service.FrequenciesService; import org.opendaylight.transportpce.test.AbstractTest; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev170818.TransportpceNetworkutilsService; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.TransportpceNetworkutilsService; @RunWith(MockitoJUnitRunner.StrictStubs.class) public class NetworkModelProviderTest extends AbstractTest { diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java index bccb0ff2a..5c5f959df 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmOtnTopologyTest.java @@ -35,6 +35,7 @@ import org.junit.Test; import org.opendaylight.transportpce.networkmodel.dto.TopologyShard; import org.opendaylight.transportpce.networkmodel.util.test.JsonUtil; import org.opendaylight.transportpce.networkmodel.util.test.NetworkmodelTestUtil; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.Network; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingBuilder; @@ -43,6 +44,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmappi import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.NodesBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.nodes.NodeInfoBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Node1; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1; import org.opendaylight.yang.gen.v1.http.org.openroadm.device.types.rev191129.NodeTypes; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.OduSwitchingPools; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.types.rev201211.xpdr.odu.switching.pools.odu.switching.pools.NonBlockingList; @@ -62,8 +64,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10 import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.If10GEODU2e; import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCH; import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOCHOTU4ODU4; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.Node; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.network.node.SupportingNode; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId; @@ -149,7 +149,12 @@ public class OpenRoadmOtnTopologyTest { assertEquals("XPDR1-CLIENT1", tps.get(0).getTpId().getValue()); assertEquals( "XPDR1-NETWORK1", - tps.get(0).augmentation(TerminationPoint1.class).getAssociatedConnectionMapPort()); + tps.get(0) + .augmentation(TerminationPoint1.class) + .getAssociatedConnectionMapTp() + .iterator() + .next() + .getValue()); assertEquals( "only If100GE interface capabitily expected", 1, @@ -170,15 +175,16 @@ public class OpenRoadmOtnTopologyTest { assertEquals( "first TP must be of type client", OpenroadmTpType.XPONDERCLIENT, - tps.get(0).augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 - .TerminationPoint1.class) - .getTpType()); + tps.get(0).augmentation(TerminationPoint1.class).getTpType()); //tests network tp assertEquals("XPDR1-NETWORK1", tps.get(2).getTpId().getValue()); assertEquals( "XPDR1-CLIENT1", - tps.get(2).augmentation(TerminationPoint1.class).getAssociatedConnectionMapPort()); + tps.get(2).augmentation(TerminationPoint1.class) + .getAssociatedConnectionMapTp() + .iterator() + .next() + .getValue()); assertEquals( "only IfOCH interface capabitily expected", 1, @@ -209,9 +215,7 @@ public class OpenRoadmOtnTopologyTest { assertEquals( "third TP must be of type network", OpenroadmTpType.XPONDERNETWORK, - tps.get(2).augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) - .getTpType()); + tps.get(2).augmentation(TerminationPoint1.class).getTpType()); } @Test @@ -275,7 +279,7 @@ public class OpenRoadmOtnTopologyTest { "otn link type should be OTU4", OtnLinkType.OTU4, sortedLinks.get(0).augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1.class) + org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.Link1.class) .getOtnLinkType()); } @@ -349,8 +353,8 @@ public class OpenRoadmOtnTopologyTest { "otn link type should be ODTU4", OtnLinkType.ODTU4, sortedLinks.get(0) - .augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1.class) + .augmentation(org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630 + .Link1.class) .getOtnLinkType()); assertEquals("list of TPs should contain 2 updated TPs", 2, topoShard.getTps().size()); @@ -977,19 +981,11 @@ public class OpenRoadmOtnTopologyTest { assertEquals( "TP should be of type client", OpenroadmTpType.XPONDERCLIENT, - tpList.get(2) - .augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 - .TerminationPoint1.class) - .getTpType()); + tpList.get(2).augmentation(TerminationPoint1.class).getTpType()); assertEquals( "TP should be of type network", OpenroadmTpType.XPONDERNETWORK, - tpList.get(4) - .augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 - .TerminationPoint1.class) - .getTpType()); + tpList.get(4).augmentation(TerminationPoint1.class).getTpType()); } else if (xpdrNb.equals(Uint16.valueOf(2))) { assertEquals("should contain 8 TPs", 8, tpList.size()); assertEquals("XPDR2-CLIENT1", tpList.get(0).getTpId().getValue()); @@ -1030,18 +1026,10 @@ public class OpenRoadmOtnTopologyTest { } assertEquals( "TP should be of type client", OpenroadmTpType.XPONDERCLIENT, - tpList.get(2) - .augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 - .TerminationPoint1.class) - .getTpType()); + tpList.get(2).augmentation(TerminationPoint1.class).getTpType()); assertEquals( "TP should be of type network", OpenroadmTpType.XPONDERNETWORK, - tpList.get(6) - .augmentation( - org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210 - .TerminationPoint1.class) - .getTpType()); + tpList.get(6).augmentation(TerminationPoint1.class).getTpType()); } } } diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopologyTest.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopologyTest.java index b8c3c62e1..4acee5cbd 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopologyTest.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/OpenRoadmTopologyTest.java @@ -363,14 +363,19 @@ public class OpenRoadmTopologyTest { assertEquals(4, tps.size()); assertEquals("XPDR1-CLIENT1", tps.get(0).getTpId().getValue()); assertEquals(OpenroadmTpType.XPONDERCLIENT, tps.get(0).augmentation(TerminationPoint1.class).getTpType()); - assertEquals("XPDR1-NETWORK1", tps.get(0).augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort()); + assertEquals("XPDR1-NETWORK1", tps.get(0).augmentation(TerminationPoint1.class) + .getAssociatedConnectionMapTp() + .iterator() + .next() + .getValue()); assertEquals("XPDR1-NETWORK1", tps.get(2).getTpId().getValue()); assertEquals(OpenroadmTpType.XPONDERNETWORK, tps.get(2).augmentation(TerminationPoint1.class).getTpType()); assertEquals("XPDR1-CLIENT1", tps.get(2).augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort()); + TerminationPoint1.class) + .getAssociatedConnectionMapTp() + .iterator() + .next() + .getValue()); } private void checkOtnXpdrNode(Node node) { diff --git a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java index 897c1ca76..bfc6f672f 100644 --- a/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java +++ b/networkmodel/src/test/java/org/opendaylight/transportpce/networkmodel/util/test/NetworkmodelTestUtil.java @@ -15,6 +15,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import org.opendaylight.transportpce.common.NetworkUtils; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.Mapping; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.mapping.MappingKey; @@ -43,7 +44,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.IfOC import org.opendaylight.yang.gen.v1.http.org.openroadm.port.types.rev201211.SupportedIfCapability; import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev211210.xpdr.otn.tp.attributes.OdtuTpnPool; import org.opendaylight.yang.gen.v1.http.org.openroadm.xponder.rev211210.xpdr.otn.tp.attributes.OdtuTpnPoolBuilder; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId; @@ -113,7 +113,8 @@ public final class NetworkmodelTestUtil { .setUsedBandwidth(Uint32.valueOf(100000 - availBW.intValue())) .build()) .addAugmentation( - new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1Builder() + new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630 + .Link1Builder() .setOtnLinkType(type) .build()) .build(); @@ -137,7 +138,8 @@ public final class NetworkmodelTestUtil { .setUsedBandwidth(Uint32.valueOf(100000 - availBW.intValue())) .build()) .addAugmentation( - new org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1Builder() + new org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630 + .Link1Builder() .setOtnLinkType(type) .build()) .build(); diff --git a/networkmodel/src/test/resources/openroadm-topology.xml b/networkmodel/src/test/resources/openroadm-topology.xml index d8d90aa8d..28f50657b 100644 --- a/networkmodel/src/test/resources/openroadm-topology.xml +++ b/networkmodel/src/test/resources/openroadm-topology.xml @@ -59,29 +59,25 @@ XPDR1-CLIENT1 - XPDR1-NETWORK1 + XPDR1-NETWORK1 XPONDER-CLIENT XPDR1-CLIENT2 - XPDR1-NETWORK2 + XPDR1-NETWORK2 XPONDER-CLIENT XPDR1-NETWORK2 - XPDR1-CLIENT2 + XPDR1-CLIENT2 XPONDER-NETWORK XPDR1-NETWORK1 - XPDR1-CLIENT1 + XPDR1-CLIENT1 ROADM-C1-SRG1--SRG1-PP1-TXRX @@ -185,29 +181,25 @@ XPDR1-CLIENT1 - XPDR1-NETWORK1 + XPDR1-NETWORK1 XPONDER-CLIENT XPDR1-CLIENT2 - XPDR1-NETWORK2 + XPDR1-NETWORK2 XPONDER-CLIENT XPDR1-NETWORK2 - XPDR1-CLIENT2 + XPDR1-CLIENT2 XPONDER-NETWORK XPDR1-NETWORK1 - XPDR1-CLIENT1 + XPDR1-CLIENT1 ROADM-A1-SRG1--SRG1-PP1-TXRX diff --git a/ordmodels/network/src/main/yang/transportpce-topology@2022-01-23.yang b/ordmodels/network/src/main/yang/transportpce-topology@2022-01-23.yang deleted file mode 100644 index 39c7399c0..000000000 --- a/ordmodels/network/src/main/yang/transportpce-topology@2022-01-23.yang +++ /dev/null @@ -1,105 +0,0 @@ -module transportpce-topology { - yang-version 1.1; - namespace "http://transportpce/topology"; - prefix "transportpce-topology"; - - import ietf-network { - prefix nd; - revision-date 2018-02-26; - } - import ietf-network-topology { - prefix nwt; - revision-date 2018-02-26; - } - import org-openroadm-common-network { - prefix cnet; - } - - organization - "TransportPCE team"; - contact - "TransportPCE team"; - - revision 2022-01-23 { - description "Update otn-link-type enum for intermediate rates (B100G)"; - } - revision 2021-05-11 { - description "Update otn-link-type enum for higher rates"; - } - revision 2020-10-19 { - description "Update to 7.1.0 Openroadm network and common models"; - } - revision 2020-01-29 { - description "Add transportpce augmentation to manage otn-link-type in otn-topology"; - } - revision 2020-01-23 { - description "Add transportpce augmentation for otn-topology"; - } - revision 2019-06-25 { - description "Initial revision"; - } - - typedef otn-link-type { - type enumeration { - enum "OTU4" { - value 0; - } - enum "ODU4" { - value 1; - } - enum "ODTU4" { - value 2; - } - enum "ODU2e" { - value 3; - } - enum "ODU0" { - value 4; - } - enum "OTUC4" { - value 5; - } - enum "ODUC4" { - value 6; - } - enum "OTUC3" { - value 7; - } - enum "ODUC3" { - value 8; - } - enum "OTUC2" { - value 9; - } - enum "ODUC2" { - value 10; - } - } - } - - augment "/nd:networks/nd:network/nd:node/nwt:termination-point" { - when "../../nd:network-types/cnet:openroadm-common-network/openroadm-topology or ../../nd:network-types/cnet:openroadm-common-network/otn-topology"; - description - "Defines associated logical-connection-point for XPDR port."; - leaf associated-connection-map-port { - when - "../cnet:tp-type = 'XPONDER-CLIENT' or ../cnet:tp-type = 'XPONDER-NETWORK'"; - type string; - description - "The xpdr port connectable regarding the device connection-map"; - } - } - - augment "/nd:networks/nd:network/nwt:link" { - when "../nd:network-types/cnet:openroadm-common-network/otn-topology"; - description - "Defines more accurate otn link types to differentiate otn links in otn-topology"; - leaf otn-link-type { - when - "../cnet:link-type = 'OTN-LINK'"; - type otn-link-type; - description - "type of otn link, to help link management inside transportpce"; - } - } -} diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java index 7eb06d8cb..9e28aa9bd 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceLink.java @@ -13,6 +13,7 @@ import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.Map; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.Link1; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; @@ -22,7 +23,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.network.topology.rev21121 import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.OpenroadmLinkType; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.link.concatenation.LinkConcatenation; import org.opendaylight.yang.gen.v1.http.org.openroadm.network.types.rev211210.link.concatenation.LinkConcatenationKey; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NodeId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.LinkId; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.TpId; @@ -319,7 +319,8 @@ public class PceLink implements Serializable { } OtnLinkType otnLinkType = link - .augmentation(org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.Link1.class) + .augmentation(org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils + .rev220630.Link1.class) .getOtnLinkType(); if (this.availableBandwidth == 0L) { LOG.error("PceLink: No bandwidth available for OTN Link, link {} is ignored ", linkId); diff --git a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOpticalNode.java b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOpticalNode.java index 7e96ea398..01bf4d34c 100644 --- a/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOpticalNode.java +++ b/pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceOpticalNode.java @@ -285,11 +285,8 @@ public class PceOpticalNode implements PceNode { continue; } // find Client of this network TP - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1 tpceTp1 = - tp.augmentation(org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123 - .TerminationPoint1.class); - if (tpceTp1 != null) { - String client = tpceTp1.getAssociatedConnectionMapPort(); + if (cntp1.getAssociatedConnectionMapTp() != null) { + String client = cntp1.getAssociatedConnectionMapTp().iterator().next().getValue(); if (client != null) { this.clientPerNwTp.put(tp.getTpId().getValue(), client); this.valid = true; diff --git a/pce/src/test/resources/gnpy/gnpy_topology.json b/pce/src/test/resources/gnpy/gnpy_topology.json index 9f902b809..da07adf49 100644 --- a/pce/src/test/resources/gnpy/gnpy_topology.json +++ b/pce/src/test/resources/gnpy/gnpy_topology.json @@ -2292,52 +2292,72 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { @@ -2378,52 +2398,72 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { @@ -2464,52 +2504,72 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { @@ -2550,52 +2610,72 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { @@ -2636,52 +2716,72 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" }, { diff --git a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java index 4add60c57..f8e22e28b 100644 --- a/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java +++ b/renderer/src/main/java/org/opendaylight/transportpce/renderer/provisiondevice/RendererServiceOperationsImpl.java @@ -41,6 +41,7 @@ import org.opendaylight.transportpce.renderer.provisiondevice.tasks.OtnDeviceRen import org.opendaylight.transportpce.renderer.provisiondevice.tasks.RollbackProcessor; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.Action; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.device.renderer.rev211004.OtnServicePathInput; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmInputBuilder; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.GetPmOutput; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.olm.rev210618.ServicePowerSetupInput; @@ -72,7 +73,6 @@ import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.link.tp.LinkTp; import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.olm.get.pm.input.ResourceIdentifierBuilder; import org.opendaylight.yang.gen.v1.http.org.transportpce.common.types.rev210930.optical.renderer.nodes.Nodes; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.binding.Notification; import org.opendaylight.yangtools.yang.common.Uint32; diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java index 109531e34..37e7c1a22 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java @@ -105,10 +105,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.TempSer import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo.TailRetention; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime; import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java index 74d659a24..1fd4cbb39 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/PceListenerImpl.java @@ -26,10 +26,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx; import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java index a30c7d237..f983d3774 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/RendererListenerImpl.java @@ -19,6 +19,7 @@ import org.opendaylight.transportpce.pce.service.PathComputationService; import org.opendaylight.transportpce.servicehandler.ServiceInput; import org.opendaylight.transportpce.servicehandler.service.PCEServiceWrapper; import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.networkutils.rev220630.OtnLinkType; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSp; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.renderer.rpc.result.sp.Link; @@ -28,11 +29,10 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; -import org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.OtnLinkType; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationProcessServiceBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceAEndBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.notification.process.service.ServiceZEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationProcessServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceAEndBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.notification.process.service.ServiceZEndBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListener.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListener.java index 737020108..64d46b4cf 100644 --- a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListener.java +++ b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListener.java @@ -39,8 +39,8 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfo; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.delete.input.ServiceDeleteReqInfoBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder; import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java index a18f8da39..b8d5290f0 100755 --- a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java +++ b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/listeners/ServiceListenerTest.java @@ -10,6 +10,7 @@ package org.opendaylight.transportpce.servicehandler.listeners; import static org.junit.Assert.fail; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.times; @@ -19,6 +20,7 @@ import static org.mockito.Mockito.when; import java.util.Collection; import java.util.HashSet; import java.util.Map; +import java.util.Optional; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; @@ -26,10 +28,14 @@ import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.mdsal.binding.api.DataObjectModification; import org.opendaylight.mdsal.binding.api.DataTreeModification; import org.opendaylight.mdsal.binding.api.NotificationPublishService; +import org.opendaylight.transportpce.common.ResponseCodes; import org.opendaylight.transportpce.servicehandler.impl.ServicehandlerImpl; import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev210528.NodeIdType; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.ConnectionType; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.Restorable; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.configuration.response.common.ConfigurationResponseCommonBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.sdnc.request.header.SdncRequestHeaderBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceAEnd; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceAEndBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.ServiceZEnd; @@ -42,17 +48,22 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev2 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.endpoint.TxDirectionKey; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.lgx.LgxBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.port.PortBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.resiliency.ServiceResiliency; +import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev211210.service.resiliency.ServiceResiliencyBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; import org.opendaylight.yang.gen.v1.http.org.openroadm.equipment.states.types.rev191129.AdminStates; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev191129.ServiceFormat; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceCreateOutputBuilder; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.ServiceDeleteOutputBuilder; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.Services; import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.service.list.ServicesBuilder; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmService; -import org.opendaylight.yang.gen.v1.nbi.notifications.rev210813.PublishNotificationAlarmServiceBuilder; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishNotificationAlarmServiceBuilder; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint8; -@RunWith(MockitoJUnitRunner.StrictStubs.class) +@RunWith(MockitoJUnitRunner.class) public class ServiceListenerTest { @Mock @@ -88,7 +99,7 @@ public class ServiceListenerTest { } @Test - public void testOnDataTreeChangedWhenAddService() { + public void testOnDataTreeChangedWhenServiceBecomesOutOfService() { @SuppressWarnings("unchecked") final DataObjectModification service = mock(DataObjectModification.class); final Collection> changes = new HashSet<>(); @@ -96,7 +107,7 @@ public class ServiceListenerTest { changes.add(ch); when(ch.getRootNode()).thenReturn(service); - Services serviceDown = buildService(State.OutOfService, AdminStates.OutOfService); + Services serviceDown = buildService(State.OutOfService, AdminStates.InService); when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.WRITE); when(service.getDataBefore()).thenReturn(buildService(State.InService, AdminStates.InService)); when(service.getDataAfter()).thenReturn(serviceDown); @@ -107,11 +118,9 @@ public class ServiceListenerTest { verify(service, times(1)).getModificationType(); verify(service, times(3)).getDataBefore(); verify(service, times(1)).getDataAfter(); - PublishNotificationAlarmService publishNotificationAlarmService = - buildNotificationAlarmService(serviceDown, "The service is now outOfService"); try { verify(notificationPublishService, times(1)) - .putNotification(publishNotificationAlarmService); + .putNotification(buildNotificationAlarmService(serviceDown, "The service is now outOfService")); } catch (InterruptedException e) { fail("Failed publishing notification"); } @@ -142,17 +151,97 @@ public class ServiceListenerTest { } } + @Test + public void testOnDataTreeChangedWhenServiceDegradedShouldBeRerouted() { + @SuppressWarnings("unchecked") final DataObjectModification service = + mock(DataObjectModification.class); + final Collection> changes = new HashSet<>(); + @SuppressWarnings("unchecked") final DataTreeModification ch = mock(DataTreeModification.class); + changes.add(ch); + when(ch.getRootNode()).thenReturn(service); + + ServiceResiliency serviceResiliency = new ServiceResiliencyBuilder().setResiliency(Restorable.class).build(); + Services serviceAfter = new ServicesBuilder(buildService(State.OutOfService, AdminStates.InService)) + .setServiceResiliency(serviceResiliency) + .build(); + when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.WRITE); + when(service.getDataBefore()).thenReturn( + new ServicesBuilder(buildService(State.InService, AdminStates.InService)) + .setServiceResiliency(serviceResiliency) + .build()); + when(service.getDataAfter()).thenReturn(serviceAfter); + when(serviceDataStoreOperations.getService(anyString())).thenReturn(Optional.of(serviceAfter)); + when(servicehandler.serviceDelete(any())).thenReturn( + RpcResultBuilder.success( + new ServiceDeleteOutputBuilder() + .setConfigurationResponseCommon( + new ConfigurationResponseCommonBuilder() + .setResponseCode(ResponseCodes.RESPONSE_OK) + .build()) + .build()) + .buildFuture()); + when(servicehandler.serviceCreate(any())).thenReturn( + RpcResultBuilder.success( + new ServiceCreateOutputBuilder() + .setConfigurationResponseCommon( + new ConfigurationResponseCommonBuilder() + .setResponseCode(ResponseCodes.RESPONSE_OK) + .build()) + .build()) + .buildFuture()); + ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations, + notificationPublishService); + listener.onDataTreeChanged(changes); + verify(ch, times(1)).getRootNode(); + verify(service, times(1)).getModificationType(); + verify(service, times(3)).getDataBefore(); + verify(service, times(1)).getDataAfter(); + verify(servicehandler, times(1)).serviceDelete(any()); + + when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.DELETE); + listener.onDataTreeChanged(changes); + verify(servicehandler, times(1)).serviceCreate(any()); + } + + @Test + public void testOnDataTreeChangedWhenServiceDegradedShouldNotBeRerouted() { + @SuppressWarnings("unchecked") final DataObjectModification service = + mock(DataObjectModification.class); + final Collection> changes = new HashSet<>(); + @SuppressWarnings("unchecked") final DataTreeModification ch = mock(DataTreeModification.class); + changes.add(ch); + when(ch.getRootNode()).thenReturn(service); + + Services serviceAfter = buildService(State.OutOfService, AdminStates.InService); + when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.WRITE); + when(service.getDataBefore()).thenReturn(buildService(State.InService, AdminStates.InService)); + when(service.getDataAfter()).thenReturn(serviceAfter); + ServiceListener listener = new ServiceListener(servicehandler, serviceDataStoreOperations, + notificationPublishService); + listener.onDataTreeChanged(changes); + verify(ch, times(1)).getRootNode(); + verify(service, times(1)).getModificationType(); + verify(service, times(3)).getDataBefore(); + verify(service, times(1)).getDataAfter(); + verify(servicehandler, times(0)).serviceDelete(any()); + + when(service.getModificationType()).thenReturn(DataObjectModification.ModificationType.DELETE); + listener.onDataTreeChanged(changes); + verify(servicehandler, times(0)).serviceCreate(any()); + } + private Services buildService(State state, AdminStates adminStates) { ServiceAEnd serviceAEnd = getServiceAEndBuild().build(); ServiceZEnd serviceZEnd = new ServiceZEndBuilder() .setClli("clli") - .setServiceFormat(ServiceFormat.OC) + .setServiceFormat(ServiceFormat.Ethernet) .setServiceRate(Uint32.valueOf(1)) .setNodeId(new NodeIdType("XPONDER-3-2")) .setTxDirection(Map.of(new TxDirectionKey(getTxDirection().key()), getTxDirection())) .setRxDirection(Map.of(new RxDirectionKey(getRxDirection().key()), getRxDirection())) .build(); ServicesBuilder builtInput = new ServicesBuilder() + .setSdncRequestHeader(new SdncRequestHeaderBuilder().build()) .setCommonId("commonId") .setConnectionType(ConnectionType.Service) .setCustomer("Customer") @@ -168,7 +257,7 @@ public class ServiceListenerTest { private ServiceAEndBuilder getServiceAEndBuild() { return new ServiceAEndBuilder() .setClli("clli") - .setServiceFormat(ServiceFormat.OC) + .setServiceFormat(ServiceFormat.Ethernet) .setServiceRate(Uint32.valueOf(1)) .setNodeId(new NodeIdType("XPONDER-1-2")) .setTxDirection(Map.of(new TxDirectionKey(getTxDirection().key()), getTxDirection())) diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java index b68f43ccf..0f8799875 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java @@ -99,13 +99,13 @@ public class TapiProvider { private TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl; public TapiProvider(DataBroker dataBroker, RpcProviderService rpcProviderService, - OrgOpenroadmServiceService serviceHandler, ServiceDataStoreOperations serviceDataStoreOperations, + OrgOpenroadmServiceService serviceHandler,ServiceDataStoreOperations serviceDataStoreOperations, TapiListener tapiListener, NetworkTransactionService networkTransactionService, TapiNetconfTopologyListener topologyListener, TapiPortMappingListener tapiPortMappingListener, TransportpceTapinetworkutilsService tapiNetworkUtils, TapiPceListenerImpl pceListenerImpl, TapiRendererListenerImpl rendererListenerImpl, TapiServiceHandlerListenerImpl serviceHandlerListenerImpl, NotificationService notificationService, TapiOrLinkListener orLinkListener, - TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl) { + TapiNetworkModelListenerImpl tapiNetworkModelListenerImpl) { this.dataBroker = dataBroker; this.rpcProviderService = rpcProviderService; this.serviceHandler = serviceHandler; @@ -121,6 +121,7 @@ public class TapiProvider { this.notificationService = notificationService; this.orLinkListener = orLinkListener; this.tapiNetworkModelListenerImpl = tapiNetworkModelListenerImpl; + //this.notificationPublishService = notificationPublishService; } /** @@ -142,6 +143,7 @@ public class TapiProvider { TapiConnectivityImpl tapi = new TapiConnectivityImpl(this.serviceHandler, tapiContext, connectivityUtils, pceListenerImpl, rendererListenerImpl); TapiTopologyImpl topo = new TapiTopologyImpl(this.dataBroker, tapiContext, topologyUtils, tapiLink); + rpcRegistration = rpcProviderService.registerRpcImplementation(TapiConnectivityService.class, tapi); rpcProviderService.registerRpcImplementation(TapiTopologyService.class, topo); rpcProviderService.registerRpcImplementation(TapiCommonService.class, topo); diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiNetworkModelListenerImpl.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiNetworkModelListenerImpl.java index 995fee80c..2d92919b9 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiNetworkModelListenerImpl.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiNetworkModelListenerImpl.java @@ -8,6 +8,9 @@ package org.opendaylight.transportpce.tapi.listeners; import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -19,15 +22,21 @@ import java.util.Optional; import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.stream.Collectors; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.tapi.TapiStringConstants; import org.opendaylight.yang.gen.v1.http.org.openroadm.common.state.types.rev191129.State; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.DateAndTime; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.OwnedNodeEdgePoint1; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connection.LowerConnection; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.Connection; @@ -42,6 +51,12 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev18121 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.TapiNotificationListener; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.NodeEdgePointRef; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext; @@ -64,12 +79,14 @@ public class TapiNetworkModelListenerImpl implements TapiNotificationListener { private final Uuid tapiTopoUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER .getBytes(StandardCharsets.UTF_8)).toString()); private final List orderedServiceLayerList; + private final NotificationPublishService notificationPublishService; - - public TapiNetworkModelListenerImpl(NetworkTransactionService networkTransactionService) { + public TapiNetworkModelListenerImpl(NetworkTransactionService networkTransactionService, + NotificationPublishService notificationPublishService) { this.networkTransactionService = networkTransactionService; this.orderedServiceLayerList = List.of(LayerProtocolName.PHOTONICMEDIA, LayerProtocolName.ODU, LayerProtocolName.DSR, LayerProtocolName.ETH); + this.notificationPublishService = notificationPublishService; } @Override @@ -88,7 +105,64 @@ public class TapiNetworkModelListenerImpl implements TapiNotificationListener { .map(NameAndValueChange::getNewValue) .collect(Collectors.toList())); updateConnectivityServices(); - // todo create NotificationPublishSerivce (Tapi) object + send Notification + // todo set attributes + for (ConnectivityService connService : this.connectivityServiceChanges) { + sendNbiNotification(createNbiNotification(connService)); + } + } + } + + private PublishTapiNotificationService createNbiNotification(ConnectivityService connService) { + if (connService == null) { + LOG.error("ConnService is null"); + return null; + } + Map changedStates = new HashMap<>(); + changedStates.put(new ChangedAttributesKey("administrativeState"), + new ChangedAttributesBuilder() + .setNewValue(connService.getAdministrativeState().getName()) + .setOldValue(connService.getAdministrativeState().equals(AdministrativeState.UNLOCKED) + ? AdministrativeState.LOCKED.getName() : AdministrativeState.UNLOCKED.getName()) + .setValueName("administrativeState").build()); + changedStates.put(new ChangedAttributesKey("operationalState"), + new ChangedAttributesBuilder() + .setNewValue(connService.getOperationalState().getName()) + .setOldValue(connService.getOperationalState().equals(OperationalState.ENABLED) + ? OperationalState.DISABLED.getName() : OperationalState.ENABLED.getName()) + .setValueName("operationalState").build()); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx"); + OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC); + DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime)); + Map targetObjectNames = new HashMap<>(); + if (connService.getName() != null) { + for (Map.Entry entry : connService.getName().entrySet()) { + targetObjectNames.put(new TargetObjectNameKey(entry.getKey().getValueName()), + new TargetObjectNameBuilder() + .setValueName(entry.getValue().getValueName()) + .setValue(entry.getValue().getValue()) + .build()); + } + } + + return new PublishTapiNotificationServiceBuilder() + .setUuid(new Uuid(UUID.randomUUID().toString())) + .setTopic(connService.getUuid().getValue()) + .setTargetObjectIdentifier(connService.getUuid()) + .setNotificationType(NotificationType.ATTRIBUTEVALUECHANGE) + .setChangedAttributes(changedStates) + .setEventTimeStamp(datetime) + .setTargetObjectName(targetObjectNames) + .setTargetObjectType(ObjectType.CONNECTIVITYSERVICE) + .setLayerProtocolName(connService.getServiceLayer()) + .build(); + } + + private void sendNbiNotification(PublishTapiNotificationService service) { + try { + this.notificationPublishService.putNotification(service); + } catch (InterruptedException e) { + LOG.warn("Cannot send notification to nbi", e); + Thread.currentThread().interrupt(); } } @@ -119,8 +193,8 @@ public class TapiNetworkModelListenerImpl implements TapiNotificationListener { OperationalState operState = (OperationalState) states.get(connService.getUuid())[1]; InstanceIdentifier connServIID = InstanceIdentifier - .builder(Context.class).augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi - .connectivity.rev181210.Context1.class) + .builder(Context.class).augmentation(org.opendaylight.yang.gen.v1 + .urn.onf.otcc.yang.tapi.connectivity.rev181210.Context1.class) .child(ConnectivityContext.class) .child(ConnectivityService.class, new ConnectivityServiceKey(connService.getUuid())) .build(); diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiRendererListenerImpl.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiRendererListenerImpl.java index 24d5e3097..0080c77c1 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiRendererListenerImpl.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/listeners/TapiRendererListenerImpl.java @@ -8,22 +8,33 @@ package org.opendaylight.transportpce.tapi.listeners; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; -import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.Map; import java.util.Optional; import java.util.UUID; import java.util.concurrent.ExecutionException; import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.NotificationPublishService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.network.NetworkTransactionImpl; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.common.network.RequestProcessor; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.RendererRpcResultSp; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationService; +import org.opendaylight.yang.gen.v1.nbi.notifications.rev211013.PublishTapiNotificationServiceBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.AdministrativeState; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.DateAndTime; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LifecycleState; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.OperationalState; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.Context1; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionKey; @@ -31,6 +42,14 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18121 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceKey; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.Connection; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.NotificationType; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.ObjectType; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributes; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.ChangedAttributesKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectName; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.notification.TargetObjectNameKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,10 +61,12 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener { private Uuid serviceUuid; private RendererRpcResultSp serviceRpcResultSp; private final NetworkTransactionService networkTransactionService; + private final NotificationPublishService notificationPublishService; - public TapiRendererListenerImpl(DataBroker dataBroker) { + public TapiRendererListenerImpl(DataBroker dataBroker, NotificationPublishService notificationPublishService) { this.dataBroker = dataBroker; this.networkTransactionService = new NetworkTransactionImpl(new RequestProcessor(this.dataBroker)); + this.notificationPublishService = notificationPublishService; } @Override @@ -98,7 +119,7 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener { LOG.error("Couldnt retrieve service from datastore"); return; } - LOG.info("Connectivity service = {}", connectivityService.toString()); + LOG.info("Connectivity service = {}", connectivityService); // TODO --> this throws error because the renderer goes really fast. Is this normal?? ConnectivityService updtConnServ = new ConnectivityServiceBuilder(connectivityService) .setAdministrativeState(AdministrativeState.UNLOCKED) @@ -109,6 +130,8 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener { updateConnectionState(connection.getConnectionUuid()); } updateConnectivityService(updtConnServ); + // TODO: need to send notification to kafka in case the topic exists!! + sendNbiNotification(createNbiNotification(updtConnServ)); } /** @@ -118,7 +141,7 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener { private void onFailedServiceImplementation(String serviceName) { LOG.error("Renderer implementation failed !"); LOG.info("PCE cancel resource done OK !"); - Uuid suuid = new Uuid(UUID.nameUUIDFromBytes(serviceName.getBytes(Charset.forName("UTF-8"))) + Uuid suuid = new Uuid(UUID.nameUUIDFromBytes(serviceName.getBytes(StandardCharsets.UTF_8)) .toString()); // get connections of connectivity service and remove them from tapi context and then remove // service from context. The CEPs are maintained as they could be reused by another service @@ -278,6 +301,66 @@ public class TapiRendererListenerImpl implements TransportpceRendererListener { } } + private void sendNbiNotification(PublishTapiNotificationService service) { + try { + this.notificationPublishService.putNotification(service); + } catch (InterruptedException e) { + LOG.warn("Cannot send notification to nbi", e); + Thread.currentThread().interrupt(); + } + } + + private PublishTapiNotificationService createNbiNotification(ConnectivityService connService) { + if (connService == null) { + LOG.error("ConnService is null"); + return null; + } + /* + Map changedStates = changedAttributesMap.entrySet() + .stream() + .filter(e -> e.getKey().getValueName().equals("administrative") + || e.getKey().getValueName().equals("operational")) + .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())); + + */ + Map changedStates = new HashMap<>(); + changedStates.put(new ChangedAttributesKey("administrativeState"), + new ChangedAttributesBuilder() + .setNewValue(connService.getAdministrativeState().getName()) + .setOldValue(AdministrativeState.LOCKED.getName()) + .setValueName("administrativeState").build()); + changedStates.put(new ChangedAttributesKey("operationalState"), + new ChangedAttributesBuilder() + .setNewValue(connService.getOperationalState().getName()) + .setOldValue(OperationalState.DISABLED.getName()) + .setValueName("operationalState").build()); + DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssxxx"); + OffsetDateTime offsetDateTime = OffsetDateTime.now(ZoneOffset.UTC); + DateAndTime datetime = new DateAndTime(dtf.format(offsetDateTime)); + Map targetObjectNames = new HashMap<>(); + if (connService.getName() != null) { + for (Map.Entry entry : connService.getName().entrySet()) { + targetObjectNames.put(new TargetObjectNameKey(entry.getKey().getValueName()), + new TargetObjectNameBuilder() + .setValueName(entry.getValue().getValueName()) + .setValue(entry.getValue().getValue()) + .build()); + } + } + + return new PublishTapiNotificationServiceBuilder() + .setUuid(new Uuid(UUID.randomUUID().toString())) + .setTopic(connService.getUuid().getValue()) + .setTargetObjectIdentifier(connService.getUuid()) + .setNotificationType(NotificationType.ATTRIBUTEVALUECHANGE) + .setChangedAttributes(changedStates) + .setEventTimeStamp(datetime) + .setTargetObjectName(targetObjectNames) + .setTargetObjectType(ObjectType.CONNECTIVITYSERVICE) + .setLayerProtocolName(connService.getServiceLayer()) + .build(); + } + public void setServiceUuid(Uuid serviceUuid) { this.serviceUuid = serviceUuid; } diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java index 03a39fac6..d7c5c21f5 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiFullTopo.java @@ -365,9 +365,9 @@ public class ConvertORTopoToTapiFullTopo { int count = 1; for (TerminationPoint tp : this.oorNetworkPortList) { TpId tpid1 = tp.getTpId(); - TpId tpid2 = new TpId(tp.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort()); + TpId tpid2 = tp.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) + .getAssociatedConnectionMapTp().iterator().next(); Set tpList = new HashSet<>(); tpList.add(tpid1); tpList.add(tpid2); diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java index 7abf12f25..aab9df4b0 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/ConvertORTopoToTapiTopo.java @@ -293,9 +293,9 @@ public class ConvertORTopoToTapiTopo { int count = 1; for (TerminationPoint tp : this.oorNetworkPortList) { TpId tpid1 = tp.getTpId(); - TpId tpid2 = new TpId(tp.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort()); + TpId tpid2 = tp.augmentation( + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) + .getAssociatedConnectionMapTp().iterator().next(); Set tpList = new HashSet<>(); tpList.add(tpid1); tpList.add(tpid2); diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImpl.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImpl.java index edfa562c0..579901651 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImpl.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TapiTopologyImpl.java @@ -409,8 +409,8 @@ public class TapiTopologyImpl implements TapiTopologyService, TapiCommonService String networkLcp; if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERCLIENT)) { networkLcp = tp.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort(); + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) + .getAssociatedConnectionMapTp().iterator().next().getValue(); } else { networkLcp = tp.getTpId().getValue(); } diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TopologyUtils.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TopologyUtils.java index af77db43a..02cba20e2 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TopologyUtils.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/topology/TopologyUtils.java @@ -222,8 +222,8 @@ public final class TopologyUtils { String networkLcp; if (tp.augmentation(TerminationPoint1.class).getTpType().equals(OpenroadmTpType.XPONDERCLIENT)) { networkLcp = tp.augmentation( - org.opendaylight.yang.gen.v1.http.transportpce.topology.rev220123.TerminationPoint1.class) - .getAssociatedConnectionMapPort(); + org.opendaylight.yang.gen.v1.http.org.openroadm.common.network.rev211210.TerminationPoint1.class) + .getAssociatedConnectionMapTp().iterator().next().getValue(); } else { networkLcp = tp.getTpId().getValue(); } diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java index 12f860175..a44e50810 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java @@ -38,6 +38,7 @@ import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev18121 import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContextBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepList; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContextBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContextBuilder; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint; @@ -102,13 +103,22 @@ public class TapiContext { .build()) .build(); + org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1 notificationContext + = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1Builder() + .setNotificationContext(new NotificationContextBuilder() + .setNotification(new HashMap<>()) + .setNotifSubscription(new HashMap<>()) + .build()) + .build(); + ContextBuilder contextBuilder = new ContextBuilder() .setName(Map.of(contextName.key(), contextName)) .setUuid( new Uuid(UUID.nameUUIDFromBytes(TAPI_CONTEXT.getBytes(Charset.forName("UTF-8"))).toString())) .setServiceInterfacePoint(new HashMap<>()) .addAugmentation(connectivityContext) - .addAugmentation(topologyContext); + .addAugmentation(topologyContext) + .addAugmentation(notificationContext); // todo: add notification context InstanceIdentifier contextIID = InstanceIdentifier.builder(Context.class).build(); diff --git a/tapi/src/main/resources/OSGI-INF/blueprint/tapi-blueprint.xml b/tapi/src/main/resources/OSGI-INF/blueprint/tapi-blueprint.xml index 62a1d9633..419993e79 100644 --- a/tapi/src/main/resources/OSGI-INF/blueprint/tapi-blueprint.xml +++ b/tapi/src/main/resources/OSGI-INF/blueprint/tapi-blueprint.xml @@ -52,6 +52,7 @@ Author: Gilles Thouenon + @@ -60,6 +61,7 @@ Author: Gilles Thouenon + diff --git a/tapi/src/test/resources/openroadm-topology.xml b/tapi/src/test/resources/openroadm-topology.xml index 54068af22..f0da0c7fb 100644 --- a/tapi/src/test/resources/openroadm-topology.xml +++ b/tapi/src/test/resources/openroadm-topology.xml @@ -65,28 +65,28 @@ inService XPDR1-CLIENT1 - XPDR1-NETWORK1 + XPDR1-NETWORK1 inService inService XPONDER-CLIENT XPDR1-CLIENT2 - XPDR1-NETWORK2 + XPDR1-NETWORK2 inService inService XPONDER-CLIENT XPDR1-NETWORK2 - XPDR1-CLIENT2 + XPDR1-CLIENT2 inService inService XPONDER-NETWORK XPDR1-NETWORK1 - XPDR1-CLIENT1 + XPDR1-CLIENT1 ROADM-C1-SRG1--SRG1-PP1-TXRX @@ -235,28 +235,28 @@ inService XPDR1-CLIENT1 - XPDR1-NETWORK1 + XPDR1-NETWORK1 inService inService XPONDER-CLIENT XPDR1-CLIENT2 - XPDR1-NETWORK2 + XPDR1-NETWORK2 inService inService XPONDER-CLIENT XPDR1-NETWORK2 - XPDR1-CLIENT2 + XPDR1-CLIENT2 inService inService XPONDER-NETWORK XPDR1-NETWORK1 - XPDR1-CLIENT1 + XPDR1-CLIENT1 inService inService XPONDER-NETWORK diff --git a/tapi/src/test/resources/otn-topology.xml b/tapi/src/test/resources/otn-topology.xml index e02d8d031..c2086f650 100644 --- a/tapi/src/test/resources/otn-topology.xml +++ b/tapi/src/test/resources/otn-topology.xml @@ -12,7 +12,7 @@ inService XPDR1-CLIENT1 - XPDR1-NETWORK1 + XPDR1-NETWORK1 x:if-100GE @@ -25,7 +25,7 @@ XPDR1-CLIENT2 - XPDR1-NETWORK2 + XPDR1-NETWORK2 x:if-100GE @@ -43,7 +43,7 @@ XPDR-C1-XPDR1 XPDR1-NETWORK2 - XPDR1-CLIENT2 + XPDR1-CLIENT2 x:if-OCH @@ -61,7 +61,7 @@ XPDR-C1-XPDR1 XPDR1-NETWORK1 - XPDR1-CLIENT1 + XPDR1-CLIENT1 x:if-OCH @@ -403,7 +403,7 @@ inService XPDR1-CLIENT1 - XPDR1-NETWORK1 + XPDR1-NETWORK1 x:if-100GE @@ -416,7 +416,7 @@ XPDR1-CLIENT2 - XPDR1-NETWORK2 + XPDR1-NETWORK2 x:if-100GE @@ -434,7 +434,7 @@ XPDR-A1-XPDR1 XPDR1-NETWORK2 - XPDR1-CLIENT2 + XPDR1-CLIENT2 x:if-OCH @@ -452,7 +452,7 @@ XPDR-A1-XPDR1 XPDR1-NETWORK1 - XPDR1-CLIENT1 + XPDR1-CLIENT1 x:if-OCH @@ -1431,7 +1431,7 @@ XPDR1-NETWORK1 SPDR-SA1-XPDR1 - OTU4 + OTU4 OTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1 @@ -1449,7 +1449,7 @@ XPDR1-NETWORK1 SPDR-SC1-XPDR1 - OTU4 + OTU4 ODTU4-SPDR-SC1-XPDR1-XPDR1-NETWORK1toSPDR-SA1-XPDR1-XPDR1-NETWORK1 @@ -1467,7 +1467,7 @@ XPDR1-NETWORK1 SPDR-SA1-XPDR1 - ODTU4 + ODTU4 ODTU4-SPDR-SA1-XPDR1-XPDR1-NETWORK1toSPDR-SC1-XPDR1-XPDR1-NETWORK1 @@ -1485,7 +1485,7 @@ XPDR1-NETWORK1 SPDR-SC1-XPDR1 - ODTU4 + ODTU4 diff --git a/tests/sample_configs/NW-for-test-5-4.xml b/tests/sample_configs/NW-for-test-5-4.xml index 20d05c964..e0f1176d8 100644 --- a/tests/sample_configs/NW-for-test-5-4.xml +++ b/tests/sample_configs/NW-for-test-5-4.xml @@ -157,56 +157,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -368,56 +368,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -579,56 +579,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -790,56 +790,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -1001,56 +1001,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -1212,56 +1212,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -1423,56 +1423,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -1634,56 +1634,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -1845,56 +1845,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -2056,56 +2056,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -2267,56 +2267,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -2478,56 +2478,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -2689,56 +2689,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -2900,56 +2900,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -3111,56 +3111,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -3322,56 +3322,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -3533,56 +3533,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -3744,56 +3744,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -3955,56 +3955,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService @@ -4166,56 +4166,56 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService diff --git a/tests/sample_configs/NW-simple-topology.xml b/tests/sample_configs/NW-simple-topology.xml index 646868ba2..6153b9700 100644 --- a/tests/sample_configs/NW-simple-topology.xml +++ b/tests/sample_configs/NW-simple-topology.xml @@ -176,101 +176,101 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -444,105 +444,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -716,105 +716,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -988,105 +988,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -1260,105 +1260,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -1532,105 +1532,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -1804,105 +1804,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -2076,105 +2076,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService @@ -2348,105 +2348,105 @@ XPDR-NW1-RX XPONDER-NETWORK - Client-1 + Client-1 inService inService XPDR-NW1-TX XPONDER-NETWORK - Client-1 + Client-1 inService inService Client-1 XPONDER-CLIENT - XPDR-NW1 + XPDR-NW1 inService inService XPDR-NW2-RX XPONDER-NETWORK - Client-2 + Client-2 inService inService XPDR-NW2-TX XPONDER-NETWORK - Client-2 + Client-2 inService inService Client-2 XPONDER-CLIENT - XPDR-NW2 + XPDR-NW2 inService inService XPDR-NW3-RX XPONDER-NETWORK - Client-3 + Client-3 inService inService XPDR-NW3-TX XPONDER-NETWORK - Client-3 + Client-3 inService inService Client-3 XPONDER-CLIENT - XPDR-NW3 + XPDR-NW3 inService inService XPDR-NW4-RX XPONDER-NETWORK - Client-4 + Client-4 inService inService XPDR-NW4-TX XPONDER-NETWORK - Client-4 + Client-4 inService inService Client-4 XPONDER-CLIENT - XPDR-NW4 + XPDR-NW4 inService inService XPDR-NW5-RX XPONDER-NETWORK - Client-5 + Client-5 inService inService XPDR-NW5-TX XPONDER-NETWORK - Client-5 + Client-5 inService inService Client-5 XPONDER-CLIENT - XPDR-NW5 + XPDR-NW5 inService inService diff --git a/tests/sample_configs/gnpy/openroadmTopology.json b/tests/sample_configs/gnpy/openroadmTopology.json index 3029dcacc..283c4c6b9 100644 --- a/tests/sample_configs/gnpy/openroadmTopology.json +++ b/tests/sample_configs/gnpy/openroadmTopology.json @@ -2691,70 +2691,90 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" @@ -2809,70 +2829,90 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" @@ -2927,70 +2967,90 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" @@ -3045,70 +3105,90 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" @@ -3163,70 +3243,90 @@ "ietf-network-topology:termination-point": [ { "tp-id": "XPDR-NW1-RX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-RX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-RX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-RX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW1-TX", - "transportpce-topology:associated-connection-map-port": "Client-1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-1" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-RX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW2-TX", - "transportpce-topology:associated-connection-map-port": "Client-2", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-2" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW5-TX", - "transportpce-topology:associated-connection-map-port": "Client-5", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-5" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW3-TX", - "transportpce-topology:associated-connection-map-port": "Client-3", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-3" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" }, { "tp-id": "XPDR-NW4-TX", - "transportpce-topology:associated-connection-map-port": "Client-4", + "org-openroadm-common-network:associated-connection-map-tp": [ + "Client-4" + ], "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", "administrative-state": "inService", "operational-state": "inService" diff --git a/tests/sample_configs/honeynode-otntopo400G.json b/tests/sample_configs/honeynode-otntopo400G.json index c23fb1b00..a4cd5f3a3 100644 --- a/tests/sample_configs/honeynode-otntopo400G.json +++ b/tests/sample_configs/honeynode-otntopo400G.json @@ -24,7 +24,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT" @@ -45,7 +47,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" @@ -84,7 +88,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT" @@ -105,7 +111,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" diff --git a/tests/sample_configs/honeynode-otntopo400GwithODUC4.json b/tests/sample_configs/honeynode-otntopo400GwithODUC4.json index 5d69ad00f..548b0b291 100644 --- a/tests/sample_configs/honeynode-otntopo400GwithODUC4.json +++ b/tests/sample_configs/honeynode-otntopo400GwithODUC4.json @@ -24,7 +24,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT" @@ -45,7 +47,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" @@ -84,7 +88,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT" @@ -105,7 +111,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" @@ -555,7 +563,7 @@ "org-openroadm-otn-network-topology:available-bandwidth": "0", "org-openroadm-otn-network-topology:used-bandwidth": "400000", "org-openroadm-common-network:link-type": "OTN-LINK", - "transportpce-topology:otn-link-type": "OTUC4", + "transportpce-networkutils:otn-link-type": "OTUC4", "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:opposite-link": "OTUC4-XPDR-C2-XPDR2-XPDR2-NETWORK1toXPDR-A2-XPDR2-XPDR2-NETWORK1" @@ -575,7 +583,7 @@ "org-openroadm-common-network:link-type": "OTN-LINK", "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", - "transportpce-topology:otn-link-type": "OTUC4", + "transportpce-networkutils:otn-link-type": "OTUC4", "org-openroadm-common-network:opposite-link": "OTUC4-XPDR-A2-XPDR2-XPDR2-NETWORK1toXPDR-C2-XPDR2-XPDR2-NETWORK1" }, { @@ -591,7 +599,7 @@ "org-openroadm-otn-network-topology:available-bandwidth": "400000", "org-openroadm-otn-network-topology:used-bandwidth": "0", "org-openroadm-common-network:link-type": "OTN-LINK", - "transportpce-topology:otn-link-type": "ODUC4", + "transportpce-networkutils:otn-link-type": "ODUC4", "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:opposite-link": "ODUC4-XPDR-C2-XPDR2-XPDR2-NETWORK1toXPDR-A2-XPDR2-XPDR2-NETWORK1" @@ -611,7 +619,7 @@ "org-openroadm-common-network:link-type": "OTN-LINK", "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", - "transportpce-topology:otn-link-type": "ODUC4", + "transportpce-networkutils:otn-link-type": "ODUC4", "org-openroadm-common-network:opposite-link": "ODUC4-XPDR-A2-XPDR2-XPDR2-NETWORK1toXPDR-C2-XPDR2-XPDR2-NETWORK1" } ] diff --git a/tests/sample_configs/honeynode-otntopo400GwithOTUC4.json b/tests/sample_configs/honeynode-otntopo400GwithOTUC4.json index 74f345a35..09acf29bc 100644 --- a/tests/sample_configs/honeynode-otntopo400GwithOTUC4.json +++ b/tests/sample_configs/honeynode-otntopo400GwithOTUC4.json @@ -24,7 +24,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT" @@ -45,7 +47,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" @@ -84,7 +88,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT" @@ -105,7 +111,9 @@ } ] }, - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1", + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ], "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK" @@ -363,7 +371,7 @@ "org-openroadm-otn-network-topology:available-bandwidth": "400000", "org-openroadm-otn-network-topology:used-bandwidth": "0", "org-openroadm-common-network:link-type": "OTN-LINK", - "transportpce-topology:otn-link-type": "OTUC4", + "transportpce-networkutils:otn-link-type": "OTUC4", "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:opposite-link": "OTUC4-XPDR-C2-XPDR2-XPDR2-NETWORK1toXPDR-A2-XPDR2-XPDR2-NETWORK1" @@ -383,7 +391,7 @@ "org-openroadm-common-network:link-type": "OTN-LINK", "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", - "transportpce-topology:otn-link-type": "OTUC4", + "transportpce-networkutils:otn-link-type": "OTUC4", "org-openroadm-common-network:opposite-link": "OTUC4-XPDR-A2-XPDR2-XPDR2-NETWORK1toXPDR-C2-XPDR2-XPDR2-NETWORK1" } ] diff --git a/tests/sample_configs/honeynode-topo.xml b/tests/sample_configs/honeynode-topo.xml index 86f80015b..67eeadbbf 100644 --- a/tests/sample_configs/honeynode-topo.xml +++ b/tests/sample_configs/honeynode-topo.xml @@ -640,28 +640,28 @@ XPDR1-NETWORK2 XPONDER-NETWORK - XPDR1-CLIENT2 + XPDR1-CLIENT2 inService inService XPDR1-CLIENT2 XPONDER-CLIENT - XPDR1-NETWORK2 + XPDR1-NETWORK2 inService inService XPDR1-CLIENT1 XPONDER-CLIENT - XPDR1-NETWORK1 + XPDR1-NETWORK1 inService inService XPDR1-NETWORK1 XPONDER-NETWORK - XPDR1-CLIENT1 + XPDR1-CLIENT1 inService inService @@ -719,28 +719,28 @@ XPDR1-NETWORK2 XPONDER-NETWORK - XPDR1-CLIENT2 + XPDR1-CLIENT2 inService inService XPDR1-CLIENT2 XPONDER-CLIENT - XPDR1-NETWORK2 + XPDR1-NETWORK2 inService inService XPDR1-CLIENT1 XPONDER-CLIENT - XPDR1-NETWORK1 + XPDR1-NETWORK1 inService inService XPDR1-NETWORK1 XPONDER-NETWORK - XPDR1-CLIENT1 + XPDR1-CLIENT1 inService inService diff --git a/tests/sample_configs/honeynode-topo400G.json b/tests/sample_configs/honeynode-topo400G.json index 854adea78..12b66cdc8 100644 --- a/tests/sample_configs/honeynode-topo400G.json +++ b/tests/sample_configs/honeynode-topo400G.json @@ -76,7 +76,9 @@ "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT", - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1" + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ] }, { "tp-id": "XPDR1-NETWORK1", @@ -86,7 +88,9 @@ "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1" + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ] } ], "supporting-node": [ @@ -111,7 +115,9 @@ "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-CLIENT", - "transportpce-topology:associated-connection-map-port": "XPDR1-NETWORK1" + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-NETWORK1" + ] }, { "tp-id": "XPDR1-NETWORK1", @@ -121,7 +127,9 @@ "org-openroadm-common-network:operational-state": "inService", "org-openroadm-common-network:administrative-state": "inService", "org-openroadm-common-network:tp-type": "XPONDER-NETWORK", - "transportpce-topology:associated-connection-map-port": "XPDR1-CLIENT1" + "org-openroadm-common-network:associated-connection-map-tp": [ + "XPDR1-CLIENT1" + ] } ], "supporting-node": [ diff --git a/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml b/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml index d17bf8ca6..2a0b485e7 100644 --- a/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml +++ b/tests/sample_configs/openroadm/2.2.1/oper-ROADMA.xml @@ -790,7 +790,7 @@ 24Hour - -49.3 + -21.3 dBm complete @@ -850,7 +850,7 @@ 24Hour - -49.3 + -21.3 dBm complete @@ -876,4 +876,61 @@ + + + org-openroadm-interfaces:opticalTransport + opticalPowerOutput + + + true + + + 0 + 21.82 + -9.0 + + 5 + + + org-openroadm-interfaces:opticalTransport + opticalPowerInput + + true + + + -17.0 + -9.0 + -25.0 + + 10 + + + org-openroadm-interfaces:openROADMOpticalMultiplex + opticalPowerOutput + + + true + + + 0 + 21.82 + -9.0 + + 5 + + + org-openroadm-interfaces:openROADMOpticalMultiplex + opticalPowerInput + + true + + + -17.0 + -9.0 + -25.0 + + 10 + + + diff --git a/tests/transportpce_tests/1.2.1/test03_topology.py b/tests/transportpce_tests/1.2.1/test03_topology.py index 1600fe200..d6ac68084 100644 --- a/tests/transportpce_tests/1.2.1/test03_topology.py +++ b/tests/transportpce_tests/1.2.1/test03_topology.py @@ -230,9 +230,11 @@ class TransportPCETopologyTesting(unittest.TestCase): elif tpType == 'XPONDER-NETWORK': network += 1 if tpId == 'XPDR1-NETWORK2': - self.assertEqual(tp['transportpce-topology:associated-connection-map-port'], 'XPDR1-CLIENT3') + self.assertEqual( + tp['org-openroadm-common-network:associated-connection-map-tp'], ['XPDR1-CLIENT3']) elif tpId == 'XPDR1-CLIENT3': - self.assertEqual(tp['transportpce-topology:associated-connection-map-port'], 'XPDR1-NETWORK2') + self.assertEqual( + tp['org-openroadm-common-network:associated-connection-map-tp'], ['XPDR1-NETWORK2']) self.assertTrue(client == 4) self.assertTrue(network == 2) listNode.remove(nodeId) diff --git a/tests/transportpce_tests/2.2.1/test03_topology.py b/tests/transportpce_tests/2.2.1/test03_topology.py index 88ae14f69..be11ec3ab 100644 --- a/tests/transportpce_tests/2.2.1/test03_topology.py +++ b/tests/transportpce_tests/2.2.1/test03_topology.py @@ -233,9 +233,11 @@ class TransportPCEtesting(unittest.TestCase): elif tpType == 'XPONDER-NETWORK': network += 1 if tpId == 'XPDR1-NETWORK2': - self.assertEqual(tp['transportpce-topology:associated-connection-map-port'], 'XPDR1-CLIENT2') + self.assertEqual( + tp['org-openroadm-common-network:associated-connection-map-tp'], ['XPDR1-CLIENT2']) if tpId == 'XPDR1-CLIENT2': - self.assertEqual(tp['transportpce-topology:associated-connection-map-port'], 'XPDR1-NETWORK2') + self.assertEqual( + tp['org-openroadm-common-network:associated-connection-map-tp'], ['XPDR1-NETWORK2']) self.assertEqual(client, 2) self.assertEqual(network, 2) listNode.remove(nodeId) diff --git a/tests/transportpce_tests/2.2.1/test11_otn_end2end.py b/tests/transportpce_tests/2.2.1/test11_otn_end2end.py index fab752179..feb95046d 100644 --- a/tests/transportpce_tests/2.2.1/test11_otn_end2end.py +++ b/tests/transportpce_tests/2.2.1/test11_otn_end2end.py @@ -426,7 +426,7 @@ class TransportPCEtesting(unittest.TestCase): for link in res['network'][0]['ietf-network-topology:link']: self.assertIn(link['link-id'], listLinkId) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'OTU4') + link['transportpce-networkutils:otn-link-type'], 'OTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertEqual( @@ -553,7 +553,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual( link['org-openroadm-otn-network-topology:used-bandwidth'], 0) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'ODTU4') + link['transportpce-networkutils:otn-link-type'], 'ODTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertIn(link['org-openroadm-common-network:opposite-link'], diff --git a/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py b/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py index 4169b0860..22707c43e 100644 --- a/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py +++ b/tests/transportpce_tests/2.2.1/test14_otn_switch_end2end.py @@ -595,7 +595,7 @@ class TransportPCEtesting(unittest.TestCase): for link in res['network'][0]['ietf-network-topology:link']: self.assertIn(link['link-id'], listLinkId) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'OTU4') + link['transportpce-networkutils:otn-link-type'], 'OTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertEqual( @@ -847,7 +847,7 @@ class TransportPCEtesting(unittest.TestCase): for link in res['network'][0]['ietf-network-topology:link']: self.assertIn(link['link-id'], listLinkId) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'OTU4') + link['transportpce-networkutils:otn-link-type'], 'OTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertEqual( diff --git a/tests/transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py b/tests/transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py index 388c4fa25..11de71040 100644 --- a/tests/transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py +++ b/tests/transportpce_tests/2.2.1/test15_otn_end2end_with_intermediate_switch.py @@ -424,7 +424,7 @@ class TransportPCEtesting(unittest.TestCase): for link in res['network'][0]['ietf-network-topology:link']: self.assertIn(link['link-id'], listLinkId) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'OTU4') + link['transportpce-networkutils:otn-link-type'], 'OTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertEqual( @@ -486,7 +486,7 @@ class TransportPCEtesting(unittest.TestCase): for link in res['network'][0]['ietf-network-topology:link']: self.assertIn(link['link-id'], listLinkId) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'OTU4') + link['transportpce-networkutils:otn-link-type'], 'OTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertEqual( @@ -695,7 +695,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual( link['org-openroadm-otn-network-topology:used-bandwidth'], 0) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'ODTU4') + link['transportpce-networkutils:otn-link-type'], 'ODTU4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertIn(link['org-openroadm-common-network:opposite-link'], diff --git a/tests/transportpce_tests/common/test_utils.py b/tests/transportpce_tests/common/test_utils.py index 2a7dee015..65ca5e212 100644 --- a/tests/transportpce_tests/common/test_utils.py +++ b/tests/transportpce_tests/common/test_utils.py @@ -45,6 +45,7 @@ URL_CONFIG_CLLI_NET = "{}/config/ietf-network:networks/network/clli-network/" URL_CONFIG_ORDM_NET = "{}/config/ietf-network:networks/network/openroadm-network/" URL_PORTMAPPING = "{}/config/transportpce-portmapping:network/nodes/" URL_OPER_SERV_LIST = "{}/operational/org-openroadm-service:service-list/" +URL_OPER_SERV_PATH_LIST = "{}/operational/transportpce-service-path:service-path-list/" URL_GET_NBINOTIFICATIONS_PROCESS_SERV = "{}/operations/nbi-notifications:get-notifications-process-service/" URL_GET_NBINOTIFICATIONS_ALARM_SERV = "{}/operations/nbi-notifications:get-notifications-alarm-service/" URL_SERV_CREATE = "{}/operations/org-openroadm-service:service-create" @@ -53,13 +54,17 @@ URL_SERVICE_PATH = "{}/operations/transportpce-device-renderer:service-path" URL_OTN_SERVICE_PATH = "{}/operations/transportpce-device-renderer:otn-service-path" URL_TAPI_CREATE_CONNECTIVITY = "{}/operations/tapi-connectivity:create-connectivity-service" URL_TAPI_DELETE_CONNECTIVITY = "{}/operations/tapi-connectivity:delete-connectivity-service" +URL_TAPI_GET_CONNECTIVITY = "{}/operations/tapi-connectivity:get-connectivity-service-details" URL_CREATE_OTS_OMS = "{}/operations/transportpce-device-renderer:create-ots-oms" URL_PATH_COMPUTATION_REQUEST = "{}/operations/transportpce-pce:path-computation-request" URL_FULL_PORTMAPPING = "{}/config/transportpce-portmapping:network" URL_TAPI_TOPOLOGY_DETAILS = "{}/operations/tapi-topology:get-topology-details" URL_TAPI_NODE_DETAILS = "{}/operations/tapi-topology:get-node-details" +URL_TAPI_NEP_DETAILS = "{}/operations/tapi-topology:get-node-edge-point-details" URL_TAPI_SIP_LIST = "{}/operations/tapi-common:get-service-interface-point-list" URL_TAPI_SERVICE_LIST = "{}/operations/tapi-connectivity:get-connectivity-service-list" +URL_TAPI_NOTIFICATION_SUBS_SERVICE = "{}/operations/tapi-notification:create-notification-subscription-service" +URL_TAPI_GET_NOTIFICATION_LIST = "{}/operations/tapi-notification:get-notification-list" TYPE_APPLICATION_JSON = {'Content-Type': 'application/json', 'Accept': 'application/json'} TYPE_APPLICATION_XML = {'Content-Type': 'application/xml', 'Accept': 'application/xml'} @@ -408,8 +413,11 @@ def get_notifications_alarm_service_request(attr): def get_service_list_request(suffix: str): - url = URL_OPER_SERV_LIST + suffix - return get_request(url) + return get_request(URL_OPER_SERV_LIST + suffix) + + +def get_service_path_list_request(suffix: str): + return get_request(URL_OPER_SERV_PATH_LIST + suffix) def service_create_request(attr): @@ -489,6 +497,13 @@ def tapi_create_connectivity_request(topologyidorname): return post_request(URL_TAPI_CREATE_CONNECTIVITY, topologyidorname) +def tapi_get_connectivity_request(serviceidorname): + attr = { + "input": { + "service-id-or-name": serviceidorname}} + return post_request(URL_TAPI_GET_CONNECTIVITY, attr) + + def tapi_delete_connectivity_request(serviceidorname): attr = { "input": { @@ -511,6 +526,15 @@ def tapi_get_node_details_request(topologyidorname, nodeidorname): return post_request(URL_TAPI_NODE_DETAILS, attr) +def tapi_get_node_edge_point_details_request(topologyidorname, nodeidorname, nepidorname): + attr = { + "input": { + "topology-id-or-name": topologyidorname, + "node-id-or-name": nodeidorname, + "ep-id-or-name": nepidorname}} + return post_request(URL_TAPI_NEP_DETAILS, attr) + + def tapi_get_sip_details_request(): return post_request(URL_TAPI_SIP_LIST, "") @@ -519,6 +543,14 @@ def tapi_get_service_list_request(): return post_request(URL_TAPI_SERVICE_LIST, "") +def tapi_create_notification_subscription_service_request(attr): + return post_request(URL_TAPI_NOTIFICATION_SUBS_SERVICE, attr) + + +def tapi_get_notifications_list_request(attr): + return post_request(URL_TAPI_GET_NOTIFICATION_LIST, attr) + + def shutdown_process(process): if process is not None: for child in psutil.Process(process.pid).children(): diff --git a/tests/transportpce_tests/hybrid/test02_B100G_end2end.py b/tests/transportpce_tests/hybrid/test02_B100G_end2end.py index fa90adc38..2bd319118 100644 --- a/tests/transportpce_tests/hybrid/test02_B100G_end2end.py +++ b/tests/transportpce_tests/hybrid/test02_B100G_end2end.py @@ -445,7 +445,7 @@ class TransportPCEtesting(unittest.TestCase): for link in res['network'][0]['ietf-network-topology:link']: self.assertIn(link['link-id'], listLinkId) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'OTUC4') + link['transportpce-networkutils:otn-link-type'], 'OTUC4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertEqual( @@ -570,7 +570,7 @@ class TransportPCEtesting(unittest.TestCase): self.assertEqual( link['org-openroadm-otn-network-topology:used-bandwidth'], 0) self.assertEqual( - link['transportpce-topology:otn-link-type'], 'ODUC4') + link['transportpce-networkutils:otn-link-type'], 'ODUC4') self.assertEqual( link['org-openroadm-common-network:link-type'], 'OTN-LINK') self.assertIn(link['org-openroadm-common-network:opposite-link'], diff --git a/tests/transportpce_tests/hybrid/test03_autonomous_reroute.py b/tests/transportpce_tests/hybrid/test03_autonomous_reroute.py new file mode 100644 index 000000000..bd7f3f9c2 --- /dev/null +++ b/tests/transportpce_tests/hybrid/test03_autonomous_reroute.py @@ -0,0 +1,1197 @@ +#!/usr/bin/env python + +############################################################################## +# Copyright (c) 2022 Orange, Inc. and others. All rights reserved. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# pylint: disable=invalid-name +# pylint: disable=no-member +# pylint: disable=too-many-public-methods +# pylint: disable=too-many-lines + +import json +import unittest +import time +import requests +# pylint: disable=wrong-import-order +import sys + +sys.path.append('transportpce_tests/common/') +# pylint: disable=wrong-import-position +# pylint: disable=import-error +import test_utils # nopep8 + + +class TransportPCEtesting(unittest.TestCase): + processes = None + WAITING = 20 # nominal value is 300 + NODE_VERSION_221 = '2.2.1' + NODE_VERSION_71 = '7.1' + + cr_serv_sample_data = { + "input": { + "sdnc-request-header": { + "request-id": "request-1", + "rpc-action": "service-create", + "request-system-id": "appname" + }, + "service-name": "service1", + "common-id": "commonId", + "connection-type": "service", + "service-resiliency": { + "resiliency": "org-openroadm-common-service-types:restorable" + }, + "service-a-end": { + "service-rate": "400", + "node-id": "XPDR-A2", + "service-format": "Ethernet", + "clli": "NodeA", + "tx-direction": [ + { + "index": 0 + } + ], + "rx-direction": [ + { + "index": 0 + } + ], + "optic-type": "gray" + }, + "service-z-end": { + "service-rate": "400", + "node-id": "XPDR-C2", + "service-format": "Ethernet", + "clli": "NodeC", + "tx-direction": [ + { + "index": 0 + } + ], + "rx-direction": [ + { + "index": 0 + } + ], + "optic-type": "gray" + }, + "due-date": "2018-06-15T00:00:01Z", + "operator-contact": "pw1234" + } + } + + service_path_service_1_AtoZ = [ + { + "id": "16", + "resource": { + "state": "inService", + "tp-id": "SRG1-CP-TXRX", + "tp-node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "17", + "resource": { + "state": "inService", + "node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "14", + "resource": { + "state": "inService", + "tp-id": "DEG1-CTP-TXRX", + "tp-node-id": "ROADM-C1-DEG1" + } + }, + { + "id": "15", + "resource": { + "state": "inService", + "link-id": "ROADM-C1-DEG1-DEG1-CTP-TXRXtoROADM-C1-SRG1-SRG1-CP-TXRX" + } + }, + { + "id": "18", + "resource": { + "state": "inService", + "tp-id": "SRG1-PP1-TXRX", + "tp-node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "19", + "resource": { + "state": "inService", + "link-id": "ROADM-C1-SRG1-SRG1-PP1-TXRXtoXPDR-C2-XPDR1-XPDR1-NETWORK1" + } + }, + { + "id": "1", + "resource": { + "state": "inService", + "node-id": "XPDR-A2-XPDR1" + } + }, + { + "id": "2", + "resource": { + "state": "inService", + "tp-id": "XPDR1-NETWORK1", + "tp-node-id": "XPDR-A2-XPDR1" + } + }, + { + "id": "0", + "resource": { + "state": "inService", + "tp-id": "XPDR1-CLIENT1", + "tp-node-id": "XPDR-A2-XPDR1" + } + }, + { + "id": "5", + "resource": { + "state": "inService", + "node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "6", + "resource": { + "state": "inService", + "tp-id": "SRG1-CP-TXRX", + "tp-node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "3", + "resource": { + "state": "inService", + "link-id": "XPDR-A2-XPDR1-XPDR1-NETWORK1toROADM-A1-SRG1-SRG1-PP1-TXRX" + } + }, + { + "id": "4", + "resource": { + "state": "inService", + "tp-id": "SRG1-PP1-TXRX", + "tp-node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "9", + "resource": { + "state": "inService", + "node-id": "ROADM-A1-DEG2" + } + }, + { + "id": "7", + "resource": { + "state": "inService", + "link-id": "ROADM-A1-SRG1-SRG1-CP-TXRXtoROADM-A1-DEG2-DEG2-CTP-TXRX" + } + }, + { + "id": "8", + "resource": { + "state": "inService", + "tp-id": "DEG2-CTP-TXRX", + "tp-node-id": "ROADM-A1-DEG2" + } + }, + { + "id": "20", + "resource": { + "state": "inService", + "tp-id": "XPDR1-NETWORK1", + "tp-node-id": "XPDR-C2-XPDR1" + } + }, + { + "id": "12", + "resource": { + "state": "inService", + "tp-id": "DEG1-TTP-TXRX", + "tp-node-id": "ROADM-C1-DEG1" + } + }, + { + "id": "13", + "resource": { + "state": "inService", + "node-id": "ROADM-C1-DEG1" + } + }, + { + "id": "10", + "resource": { + "state": "inService", + "tp-id": "DEG2-TTP-TXRX", + "tp-node-id": "ROADM-A1-DEG2" + } + }, + { + "id": "21", + "resource": { + "state": "inService", + "node-id": "XPDR-C2-XPDR1" + } + }, + { + "id": "11", + "resource": { + "state": "inService", + "link-id": "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX" + } + }, + { + "id": "22", + "resource": { + "state": "inService", + "tp-id": "XPDR1-CLIENT1", + "tp-node-id": "XPDR-C2-XPDR1" + } + } + ] + + service_path_service_1_rerouted_AtoZ = [ + { + "id": "27", + "resource": { + "state": "inService", + "link-id": "ROADM-C1-SRG1-SRG1-PP1-TXRXtoXPDR-C2-XPDR1-XPDR1-NETWORK1" + } + }, + { + "id": "28", + "resource": { + "state": "inService", + "tp-id": "XPDR1-NETWORK1", + "tp-node-id": "XPDR-C2-XPDR1" + } + }, + { + "id": "25", + "resource": { + "state": "inService", + "node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "26", + "resource": { + "state": "inService", + "tp-id": "SRG1-PP1-TXRX", + "tp-node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "29", + "resource": { + "state": "inService", + "node-id": "XPDR-C2-XPDR1" + } + }, + { + "id": "30", + "resource": { + "state": "inService", + "tp-id": "XPDR1-CLIENT1", + "tp-node-id": "XPDR-C2-XPDR1" + } + }, + { + "id": "12", + "resource": { + "state": "inService", + "tp-id": "DEG1-TTP-TXRX", + "tp-node-id": "ROADM-B1-DEG1" + } + }, + { + "id": "13", + "resource": { + "state": "inService", + "node-id": "ROADM-B1-DEG1" + } + }, + { + "id": "10", + "resource": { + "state": "inService", + "tp-id": "DEG1-TTP-TXRX", + "tp-node-id": "ROADM-A1-DEG1" + } + }, + { + "id": "11", + "resource": { + "state": "inService", + "link-id": "ROADM-A1-DEG1-DEG1-TTP-TXRXtoROADM-B1-DEG1-DEG1-TTP-TXRX" + } + }, + { + "id": "16", + "resource": { + "state": "inService", + "tp-id": "DEG2-CTP-TXRX", + "tp-node-id": "ROADM-B1-DEG2" + } + }, + { + "id": "17", + "resource": { + "state": "inService", + "node-id": "ROADM-B1-DEG2" + } + }, + { + "id": "14", + "resource": { + "state": "inService", + "tp-id": "DEG1-CTP-TXRX", + "tp-node-id": "ROADM-B1-DEG1" + } + }, + { + "id": "15", + "resource": { + "state": "inService", + "link-id": "ROADM-B1-DEG1-DEG1-CTP-TXRXtoROADM-B1-DEG2-DEG2-CTP-TXRX" + } + }, + { + "id": "18", + "resource": { + "state": "inService", + "tp-id": "DEG2-TTP-TXRX", + "tp-node-id": "ROADM-B1-DEG2" + } + }, + { + "id": "19", + "resource": { + "state": "inService", + "link-id": "ROADM-B1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG2-DEG2-TTP-TXRX" + } + }, + { + "id": "1", + "resource": { + "state": "inService", + "node-id": "XPDR-A2-XPDR1" + } + }, + { + "id": "2", + "resource": { + "state": "inService", + "tp-id": "XPDR1-NETWORK1", + "tp-node-id": "XPDR-A2-XPDR1" + } + }, + { + "id": "0", + "resource": { + "state": "inService", + "tp-id": "XPDR1-CLIENT1", + "tp-node-id": "XPDR-A2-XPDR1" + } + }, + { + "id": "5", + "resource": { + "state": "inService", + "node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "6", + "resource": { + "state": "inService", + "tp-id": "SRG1-CP-TXRX", + "tp-node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "3", + "resource": { + "state": "inService", + "link-id": "XPDR-A2-XPDR1-XPDR1-NETWORK1toROADM-A1-SRG1-SRG1-PP1-TXRX" + } + }, + { + "id": "4", + "resource": { + "state": "inService", + "tp-id": "SRG1-PP1-TXRX", + "tp-node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "9", + "resource": { + "state": "inService", + "node-id": "ROADM-A1-DEG1" + } + }, + { + "id": "7", + "resource": { + "state": "inService", + "link-id": "ROADM-A1-SRG1-SRG1-CP-TXRXtoROADM-A1-DEG1-DEG1-CTP-TXRX" + } + }, + { + "id": "8", + "resource": { + "state": "inService", + "tp-id": "DEG1-CTP-TXRX", + "tp-node-id": "ROADM-A1-DEG1" + } + }, + { + "id": "20", + "resource": { + "state": "inService", + "tp-id": "DEG2-TTP-TXRX", + "tp-node-id": "ROADM-C1-DEG2" + } + }, + { + "id": "23", + "resource": { + "state": "inService", + "link-id": "ROADM-C1-DEG2-DEG2-CTP-TXRXtoROADM-C1-SRG1-SRG1-CP-TXRX" + } + }, + { + "id": "24", + "resource": { + "state": "inService", + "tp-id": "SRG1-CP-TXRX", + "tp-node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "21", + "resource": { + "state": "inService", + "node-id": "ROADM-C1-DEG2" + } + }, + { + "id": "22", + "resource": { + "state": "inService", + "tp-id": "DEG2-CTP-TXRX", + "tp-node-id": "ROADM-C1-DEG2" + } + } + ] + + service_path_service_2_AtoZ = [ + { + "id": "16", + "resource": { + "state": "inService", + "tp-id": "SRG1-CP-TXRX", + "tp-node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "17", + "resource": { + "state": "inService", + "node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "14", + "resource": { + "state": "inService", + "tp-id": "DEG1-CTP-TXRX", + "tp-node-id": "ROADM-C1-DEG1" + } + }, + { + "id": "15", + "resource": { + "state": "inService", + "link-id": "ROADM-C1-DEG1-DEG1-CTP-TXRXtoROADM-C1-SRG1-SRG1-CP-TXRX" + } + }, + { + "id": "18", + "resource": { + "state": "inService", + "tp-id": "SRG1-PP2-TXRX", + "tp-node-id": "ROADM-C1-SRG1" + } + }, + { + "id": "19", + "resource": { + "state": "inService", + "link-id": "ROADM-C1-SRG1-SRG1-PP2-TXRXtoXPDR-C2-XPDR3-XPDR3-NETWORK1" + } + }, + { + "id": "1", + "resource": { + "state": "inService", + "node-id": "XPDR-A2-XPDR3" + } + }, + { + "id": "2", + "resource": { + "state": "inService", + "tp-id": "XPDR3-NETWORK1", + "tp-node-id": "XPDR-A2-XPDR3" + } + }, + { + "id": "0", + "resource": { + "state": "inService", + "tp-id": "XPDR3-CLIENT1", + "tp-node-id": "XPDR-A2-XPDR3" + } + }, + { + "id": "5", + "resource": { + "state": "inService", + "node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "6", + "resource": { + "state": "inService", + "tp-id": "SRG1-CP-TXRX", + "tp-node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "3", + "resource": { + "state": "inService", + "link-id": "XPDR-A2-XPDR3-XPDR3-NETWORK1toROADM-A1-SRG1-SRG1-PP2-TXRX" + } + }, + { + "id": "4", + "resource": { + "state": "inService", + "tp-id": "SRG1-PP2-TXRX", + "tp-node-id": "ROADM-A1-SRG1" + } + }, + { + "id": "9", + "resource": { + "state": "inService", + "node-id": "ROADM-A1-DEG2" + } + }, + { + "id": "7", + "resource": { + "state": "inService", + "link-id": "ROADM-A1-SRG1-SRG1-CP-TXRXtoROADM-A1-DEG2-DEG2-CTP-TXRX" + } + }, + { + "id": "8", + "resource": { + "state": "inService", + "tp-id": "DEG2-CTP-TXRX", + "tp-node-id": "ROADM-A1-DEG2" + } + }, + { + "id": "20", + "resource": { + "state": "inService", + "tp-id": "XPDR3-NETWORK1", + "tp-node-id": "XPDR-C2-XPDR3" + } + }, + { + "id": "12", + "resource": { + "state": "inService", + "tp-id": "DEG1-TTP-TXRX", + "tp-node-id": "ROADM-C1-DEG1" + } + }, + { + "id": "13", + "resource": { + "state": "inService", + "node-id": "ROADM-C1-DEG1" + } + }, + { + "id": "10", + "resource": { + "state": "inService", + "tp-id": "DEG2-TTP-TXRX", + "tp-node-id": "ROADM-A1-DEG2" + } + }, + { + "id": "21", + "resource": { + "state": "inService", + "node-id": "XPDR-C2-XPDR3" + } + }, + { + "id": "11", + "resource": { + "state": "inService", + "link-id": "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX" + } + }, + { + "id": "22", + "resource": { + "state": "inService", + "tp-id": "XPDR3-CLIENT1", + "tp-node-id": "XPDR-C2-XPDR3" + } + } + ] + + @classmethod + def setUpClass(cls): + cls.processes = test_utils.start_tpce() + cls.processes = test_utils.start_sims([('xpdra2', cls.NODE_VERSION_71), + ('roadma', cls.NODE_VERSION_221), + ('roadmb', cls.NODE_VERSION_221), + ('roadmc', cls.NODE_VERSION_221), + ('xpdrc2', cls.NODE_VERSION_71)]) + + @classmethod + def tearDownClass(cls): + # pylint: disable=not-an-iterable + for process in cls.processes: + test_utils.shutdown_process(process) + print("all processes killed") + + def setUp(self): + time.sleep(2) + + def test_01_connect_xpdra2(self): + response = test_utils.mount_device("XPDR-A2", ('xpdra2', self.NODE_VERSION_71)) + self.assertEqual(response.status_code, + requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_02_connect_xpdrc2(self): + response = test_utils.mount_device("XPDR-C2", ('xpdrc2', self.NODE_VERSION_71)) + self.assertEqual(response.status_code, + requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_03_connect_rdma(self): + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, + requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_04_connect_rdmb(self): + response = test_utils.mount_device("ROADM-B1", ('roadmb', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, + requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_05_connect_rdmc(self): + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, + requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_06_connect_xprda2_1_N1_to_roadma_PP1(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-A2", "1", "1", + "ROADM-A1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Xponder Roadm Link created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_07_connect_roadma_PP1_to_xpdra2_1_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-A2", "1", "1", + "ROADM-A1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Roadm Xponder links created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_08_connect_xprdc2_1_N1_to_roadmc_PP1(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-C2", "1", "1", + "ROADM-C1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Xponder Roadm Link created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_09_connect_roadmc_PP1_to_xpdrc2_1_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-C2", "1", "1", + "ROADM-C1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Roadm Xponder links created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_10_connect_xprda2_3_N1_to_roadma_PP2(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-A2", "3", "1", + "ROADM-A1", "1", "SRG1-PP2-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Xponder Roadm Link created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_11_connect_roadma_PP2_to_xpdra2_3_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-A2", "3", "1", + "ROADM-A1", "1", "SRG1-PP2-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Roadm Xponder links created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_12_connect_xprdc2_3_N1_to_roadmc_PP2(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-C2", "3", "1", + "ROADM-C1", "1", "SRG1-PP2-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Xponder Roadm Link created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_13_connect_roadmc_PP2_to_xpdrc2_3_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-C2", "3", "1", + "ROADM-C1", "1", "SRG1-PP2-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Roadm Xponder links created successfully', + response.json()["output"]["result"]) + time.sleep(2) + + def test_14_add_omsAttributes_roadma_roadmc(self): + # Config ROADMA-ROADMC oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_15_add_omsAttributes_roadmc_roadma(self): + # Config ROADMC-ROADMA oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_16_add_omsAttributes_roadma_roadmb(self): + # Config ROADMA-ROADMB oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-A1-DEG1-DEG1-TTP-TXRXtoROADM-B1-DEG1-DEG1-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_17_add_omsAttributes_roadmb_roadma(self): + # Config ROADMB-ROADMA oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-B1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG1-DEG1-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_18_add_omsAttributes_roadmb_roadmc(self): + # Config ROADMB-ROADMC oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-B1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG2-DEG2-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_19_add_omsAttributes_roadmc_roadmb(self): + # Config ROADMC-ROADMB oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-C1-DEG2-DEG2-TTP-TXRXtoROADM-B1-DEG2-DEG2-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_20_create_OTS_ROADMA_DEG1(self): + response = test_utils.create_ots_oms_request("ROADM-A1", "DEG1-TTP-TXRX") + time.sleep(5) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Interfaces OTS-DEG1-TTP-TXRX - OMS-DEG1-TTP-TXRX successfully created on node ROADM-A1', + response.json()["output"]["result"]) + + def test_21_create_OTS_ROADMC_DEG2(self): + response = test_utils.create_ots_oms_request("ROADM-C1", "DEG2-TTP-TXRX") + time.sleep(5) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Interfaces OTS-DEG2-TTP-TXRX - OMS-DEG2-TTP-TXRX successfully created on node ROADM-C1', + response.json()["output"]["result"]) + + def test_22_create_OTS_ROADMB_DEG1(self): + response = test_utils.create_ots_oms_request("ROADM-B1", "DEG1-TTP-TXRX") + time.sleep(5) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Interfaces OTS-DEG1-TTP-TXRX - OMS-DEG1-TTP-TXRX successfully created on node ROADM-B1', + response.json()["output"]["result"]) + + def test_23_create_OTS_ROADMB_DEG2(self): + response = test_utils.create_ots_oms_request("ROADM-B1", "DEG2-TTP-TXRX") + time.sleep(5) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Interfaces OTS-DEG2-TTP-TXRX - OMS-DEG2-TTP-TXRX successfully created on node ROADM-B1', + response.json()["output"]["result"]) + + def test_24_calculate_span_loss_base_all(self): + data = { + "input": { + "src-type": "all" + } + } + response = test_utils.post_request("{}/operations/transportpce-olm:calculate-spanloss-base", data) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Success', + res["output"]["result"]) + self.assertIn({ + "spanloss": "25.7", + "link-id": "ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX" + }, res["output"]["spans"]) + self.assertIn({ + "spanloss": "23.6", + "link-id": "ROADM-B1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG1-DEG1-TTP-TXRX" + }, res["output"]["spans"]) + self.assertIn({ + "spanloss": "23.6", + "link-id": "ROADM-A1-DEG1-DEG1-TTP-TXRXtoROADM-B1-DEG1-DEG1-TTP-TXRX" + }, res["output"]["spans"]) + self.assertIn({ + "spanloss": "17.6", + "link-id": "ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX" + }, res["output"]["spans"]) + self.assertIn({ + "spanloss": "25.7", + "link-id": "ROADM-C1-DEG2-DEG2-TTP-TXRXtoROADM-B1-DEG2-DEG2-TTP-TXRX" + }, res["output"]["spans"]) + self.assertIn({ + "spanloss": "17.6", + "link-id": "ROADM-B1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG2-DEG2-TTP-TXRX" + }, res["output"]["spans"]) + + # test service-create for Eth service from xpdr to xpdr with service-resiliency + def test_25_create_eth_service1_with_service_resiliency_restorable(self): + self.cr_serv_sample_data["input"]["service-name"] = "service1" + response = test_utils.service_create_request(self.cr_serv_sample_data) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('PCE calculation in progress', + response.json()['output']['configuration-response-common']['response-message']) + time.sleep(self.WAITING) + + def test_26_get_eth_service1(self): + response = test_utils.get_service_list_request("services/service1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['services'][0]['operational-state'], 'inService') + self.assertEqual( + res['services'][0]['administrative-state'], 'inService') + self.assertEqual( + res['services'][0]['service-name'], 'service1') + self.assertEqual( + res['services'][0]['connection-type'], 'service') + self.assertEqual( + res['services'][0]['lifecycle-state'], 'planned') + self.assertEqual( + res['services'][0]['service-resiliency']['resiliency'], 'org-openroadm-common-service-types:restorable') + time.sleep(2) + + def test_27_get_service_path_service_1(self): + response = test_utils.get_service_path_list_request("service-paths/service1") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertCountEqual(self.service_path_service_1_AtoZ, + response.json()['service-paths'][0]['path-description']['aToZ-direction']['aToZ']) + + # test service-create for Eth service from xpdr to xpdr without service-resiliency + def test_28_create_eth_service2_without_service_resiliency(self): + self.cr_serv_sample_data["input"]["service-name"] = "service2" + del self.cr_serv_sample_data["input"]["service-resiliency"] + response = test_utils.service_create_request(self.cr_serv_sample_data) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('PCE calculation in progress', + response.json()['output']['configuration-response-common']['response-message']) + time.sleep(self.WAITING) + + def test_29_get_eth_service2(self): + response = test_utils.get_service_list_request("services/service2") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['services'][0]['operational-state'], 'inService') + self.assertEqual( + res['services'][0]['administrative-state'], 'inService') + self.assertEqual( + res['services'][0]['service-name'], 'service2') + self.assertEqual( + res['services'][0]['connection-type'], 'service') + self.assertEqual( + res['services'][0]['lifecycle-state'], 'planned') + self.assertNotIn('service-resiliency', res['services'][0]) + time.sleep(2) + + def test_30_get_service_path_service_2(self): + response = test_utils.get_service_path_list_request("service-paths/service2") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertCountEqual(self.service_path_service_2_AtoZ, + response.json()['service-paths'][0]['path-description']['aToZ-direction']['aToZ']) + + # Degrade ROADM-A1-ROADM-C1 link + def test_31_set_pm_ROADMA_OTS_DEG2_TTP_TXRX_OpticalPowerInput(self): + url = "{}/operations/pm-handling:pm-interact" + body = { + "input": { + "rpc-action": "set", + "pm-to-be-set-or-created": { + "current-pm-entry": [ + { + "pm-resource-instance": "/org-openroadm-device:org-openroadm-device/org-openroadm-device" + ":interface[org-openroadm-device:name='OTS-DEG2-TTP-TXRX']", + "pm-resource-type": "interface", + "pm-resource-type-extension": "", + "current-pm": [ + { + "type": "opticalPowerInput", + "extension": "", + "location": "nearEnd", + "direction": "rx", + "measurement": [ + { + "granularity": "15min", + "pmParameterValue": -30, + "pmParameterUnit": "dBm", + "validity": "complete" + }, + { + "granularity": "24Hour", + "pmParameterValue": -21.3, + "pmParameterUnit": "dBm", + "validity": "complete" + } + ] + } + ] + } + ] + } + } + } + response = requests.request("POST", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertEqual(response.json()['output']['status-message'], "The PMs has been successfully set !") + time.sleep(self.WAITING * 2) + + def test_32_get_eth_service1(self): + self.test_26_get_eth_service1() + + def test_33_get_service_path_service_1(self): + response = test_utils.get_service_path_list_request("service-paths/service1") + self.assertEqual(response.status_code, requests.codes.ok) + print(response.json()) + self.assertCountEqual(self.service_path_service_1_rerouted_AtoZ, + response.json()['service-paths'][0]['path-description']['aToZ-direction']['aToZ']) + + def test_34_get_eth_service2(self): + response = test_utils.get_service_list_request("services/service2") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['services'][0]['operational-state'], 'outOfService') + self.assertEqual( + res['services'][0]['administrative-state'], 'inService') + self.assertEqual( + res['services'][0]['service-name'], 'service2') + self.assertEqual( + res['services'][0]['connection-type'], 'service') + self.assertEqual( + res['services'][0]['lifecycle-state'], 'planned') + self.assertNotIn('service-resiliency', res['services'][0]) + time.sleep(2) + + def test_35_get_service_path_service_2(self): + response = test_utils.get_service_path_list_request("service-paths/service2") + index = self.service_path_service_2_AtoZ.index( + { + 'id': '10', + 'resource': { + 'state': 'inService', + 'tp-id': 'DEG2-TTP-TXRX', + 'tp-node-id': 'ROADM-A1-DEG2' + } + } + ) + service_path_expected = self.service_path_service_2_AtoZ[:index] + [{ + 'id': '10', + 'resource': { + 'state': 'outOfService', + 'tp-id': 'DEG2-TTP-TXRX', + 'tp-node-id': 'ROADM-A1-DEG2' + } + }] + self.service_path_service_2_AtoZ[index + 1:] + self.assertEqual(response.status_code, requests.codes.ok) + self.assertCountEqual(service_path_expected, + response.json()['service-paths'][0]['path-description']['aToZ-direction']['aToZ']) + + # Restore ROADM-A1-ROADM-C1 link + def test_36_clear_pm_ROADMA_OTS_DEG2_TTP_TXRX_OpticalPowerInput(self): + url = "{}/operations/pm-handling:pm-interact" + body = { + "input": { + "rpc-action": "clear", + "pm-to-get-clear-or-delete": { + "current-pm-entry": [ + { + "pm-resource-instance": "/org-openroadm-device:org-openroadm-device/org-openroadm-device" + ":interface[org-openroadm-device:name='OTS-DEG2-TTP-TXRX']", + "pm-resource-type": "interface", + "pm-resource-type-extension": "", + "current-pm": [ + { + "type": "opticalPowerInput", + "extension": "", + "location": "nearEnd", + "direction": "rx" + } + ] + } + ] + } + } + } + response = requests.request("POST", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + self.assertEqual(response.json()['output']['status-message'], "The PMs has been successfully released !") + time.sleep(2) + + def test_37_get_eth_service1(self): + self.test_26_get_eth_service1() + + def test_38_get_service_path_service_1(self): + self.test_33_get_service_path_service_1() + + def test_39_get_eth_service2(self): + self.test_29_get_eth_service2() + + def test_40_get_service_path_service_2(self): + self.test_30_get_service_path_service_2() + + def test_41_delete_eth_service2(self): + response = test_utils.service_delete_request("service2") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Renderer service delete in progress', + response.json()['output']['configuration-response-common']['response-message']) + time.sleep(self.WAITING) + + def test_42_delete_eth_service1(self): + response = test_utils.service_delete_request("service1") + self.assertEqual(response.status_code, requests.codes.ok) + self.assertIn('Renderer service delete in progress', + response.json()['output']['configuration-response-common']['response-message']) + time.sleep(self.WAITING) + + def test_43_disconnect_xponders_from_roadm(self): + url = "{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:link/" + response = test_utils.get_ordm_topo_request("") + self.assertEqual(response.status_code, requests.codes.ok) + links = response.json()['network'][0]['ietf-network-topology:link'] + for link in links: + if link["org-openroadm-common-network:link-type"] in ('XPONDER-OUTPUT', 'XPONDER-INPUT'): + self.assertEqual(test_utils.delete_request(url + link["link-id"]).status_code, requests.codes.ok) + + def test_44_disconnect_xpdra2(self): + response = test_utils.unmount_device("XPDR-A2") + self.assertEqual(response.status_code, requests.codes.ok, + test_utils.CODE_SHOULD_BE_200) + + def test_45_disconnect_xpdrc2(self): + response = test_utils.unmount_device("XPDR-C2") + self.assertEqual(response.status_code, requests.codes.ok, + test_utils.CODE_SHOULD_BE_200) + + def test_46_disconnect_roadmA(self): + response = test_utils.unmount_device("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok, + test_utils.CODE_SHOULD_BE_200) + + def test_47_disconnect_roadmB(self): + response = test_utils.unmount_device("ROADM-B1") + self.assertEqual(response.status_code, requests.codes.ok, + test_utils.CODE_SHOULD_BE_200) + + def test_48_disconnect_roadmC(self): + response = test_utils.unmount_device("ROADM-C1") + self.assertEqual(response.status_code, requests.codes.ok, + test_utils.CODE_SHOULD_BE_200) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py b/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py new file mode 100644 index 000000000..8c029aa1c --- /dev/null +++ b/tests/transportpce_tests/tapi/test03_tapi_device_change_notifications.py @@ -0,0 +1,965 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2021 Orange, Inc. and others. All rights reserved. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# pylint: disable=no-member +# pylint: disable=too-many-public-methods +import os +import json +import unittest +import time +import requests +# pylint: disable=wrong-import-order +import sys +sys.path.append('transportpce_tests/common/') +# pylint: disable=wrong-import-position +# pylint: disable=import-error +import test_utils # nopep8 + +# pylint: disable=too-few-public-methods + + +class UuidServices: + def __init__(self): + # pylint: disable=invalid-name + self.pm = None + self.odu = None + self.dsr = None + self.eth = None + + +class TransportPCEFulltesting(unittest.TestCase): + + cr_serv_sample_data = { + "input": { + "end-point": [ + { + "layer-protocol-name": "DSR", + "service-interface-point": { + "service-interface-point-uuid": "b1f4bd3b-7fa9-367b-a8ab-6e80293238df" + }, + "administrative-state": "UNLOCKED", + "operational-state": "ENABLED", + "direction": "BIDIRECTIONAL", + "role": "SYMMETRIC", + "protection-role": "WORK", + "local-id": "XPDR-C1-XPDR1", + "name": [ + { + "value-name": "OpenROADM node id", + "value": "XPDR-C1-XPDR1" + } + ] + }, + { + "layer-protocol-name": "DSR", + "service-interface-point": { + "service-interface-point-uuid": "b5964ce9-274c-3f68-b4d1-83c0b61bc74e" + }, + "administrative-state": "UNLOCKED", + "operational-state": "ENABLED", + "direction": "BIDIRECTIONAL", + "role": "SYMMETRIC", + "protection-role": "WORK", + "local-id": "XPDR-A1-XPDR1", + "name": [ + { + "value-name": "OpenROADM node id", + "value": "XPDR-A1-XPDR1" + } + ] + } + ], + "connectivity-constraint": { + "service-layer": "ETH", + "service-type": "POINT_TO_POINT_CONNECTIVITY", + "service-level": "Some service-level", + "requested-capacity": { + "total-size": { + "value": "100", + "unit": "GB" + } + } + }, + "state": "Some state" + } + } + + processes = [] + uuid_services = UuidServices() + WAITING = 25 # nominal value is 300 + NODE_VERSION_221 = '2.2.1' + + @classmethod + def setUpClass(cls): + # pylint: disable=unsubscriptable-object + cls.init_failed = False + os.environ['JAVA_MIN_MEM'] = '1024M' + os.environ['JAVA_MAX_MEM'] = '4096M' + cls.processes = test_utils.start_tpce() + # TAPI feature is not installed by default in Karaf + if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + print("installing tapi feature...") + result = test_utils.install_karaf_feature("odl-transportpce-tapi") + if result.returncode != 0: + cls.init_failed = True + print("Restarting OpenDaylight...") + test_utils.shutdown_process(cls.processes[0]) + cls.processes[0] = test_utils.start_karaf() + test_utils.process_list[0] = cls.processes[0] + cls.init_failed = not test_utils.wait_until_log_contains( + test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) + if cls.init_failed: + print("tapi installation feature failed...") + test_utils.shutdown_process(cls.processes[0]) + sys.exit(2) + cls.processes = test_utils.start_tpce() + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION_221), + ('roadma', cls.NODE_VERSION_221), + ('roadmc', cls.NODE_VERSION_221), + ('xpdrc', cls.NODE_VERSION_221)]) + + @classmethod + def tearDownClass(cls): + # pylint: disable=not-an-iterable + for process in cls.processes: + test_utils.shutdown_process(process) + print("all processes killed") + time.sleep(10) + + def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string + print("execution of {}".format(self.id().split(".")[-1])) + + def test_01_connect_xpdrA(self): + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_02_connect_xpdrC(self): + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_03_connect_rdmA(self): + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_04_connect_rdmC(self): + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_05_connect_xprdA_N1_to_roadmA_PP1(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-A1", "1", "1", + "ROADM-A1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) + time.sleep(2) + + def test_06_connect_roadmA_PP1_to_xpdrA_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-A1", "1", "1", + "ROADM-A1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) + time.sleep(2) + + def test_07_connect_xprdC_N1_to_roadmC_PP1(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-C1", "1", "1", + "ROADM-C1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) + time.sleep(2) + + def test_08_connect_roadmC_PP1_to_xpdrC_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-C1", "1", "1", + "ROADM-C1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) + time.sleep(2) + + def test_09_add_omsAttributes_ROADMA_ROADMC(self): + # Config ROADMA-ROADMC oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_10_add_omsAttributes_ROADMC_ROADMA(self): + # Config ROADMC-ROADMA oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + +# test service-create for Eth service from xpdr to xpdr + def test_11_create_connectivity_service_Ethernet(self): + response = test_utils.tapi_create_connectivity_request(self.cr_serv_sample_data) + time.sleep(self.WAITING) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.uuid_services.eth = res['output']['service']['uuid'] + # pylint: disable=consider-using-f-string + + input_dict_1 = {'administrative-state': 'LOCKED', + 'lifecycle-state': 'PLANNED', + 'operational-state': 'DISABLED', + 'service-type': 'POINT_TO_POINT_CONNECTIVITY', + 'service-layer': 'ETH', + 'connectivity-direction': 'BIDIRECTIONAL' + } + input_dict_2 = {'value-name': 'OpenROADM node id', + 'value': 'XPDR-C1-XPDR1'} + input_dict_3 = {'value-name': 'OpenROADM node id', + 'value': 'XPDR-A1-XPDR1'} + + self.assertDictEqual(dict(input_dict_1, **res['output']['service']), + res['output']['service']) + self.assertDictEqual(dict(input_dict_2, **res['output']['service']['end-point'][0]['name'][0]), + res['output']['service']['end-point'][0]['name'][0]) + self.assertDictEqual(dict(input_dict_3, **res['output']['service']['end-point'][1]['name'][0]), + res['output']['service']['end-point'][1]['name'][0]) + # If the gate fails is because of the waiting time not being enough + time.sleep(self.WAITING) + + def test_12_get_service_Ethernet(self): + response = test_utils.get_service_list_request("services/" + str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['services'][0]['administrative-state'], 'inService') + self.assertEqual( + res['services'][0]['service-name'], self.uuid_services.eth) + self.assertEqual( + res['services'][0]['connection-type'], 'service') + self.assertEqual( + res['services'][0]['lifecycle-state'], 'planned') + time.sleep(2) + + def test_13_get_connectivity_service_Ethernet(self): + response = test_utils.tapi_get_connectivity_request(str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['output']['service']['operational-state'], 'ENABLED') + self.assertEqual( + res['output']['service']['name'][0]['value'], self.uuid_services.eth) + self.assertEqual( + res['output']['service']['administrative-state'], 'UNLOCKED') + self.assertEqual( + res['output']['service']['lifecycle-state'], 'INSTALLED') + time.sleep(2) + + def test_14_change_status_line_port_xpdrc(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1" + body = {"ports": [{ + "port-name": "1", + "port-type": "CFP2", + "administrative-state": "outOfService", + "port-qual": "xpdr-network"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8144/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_15_check_update_portmapping(self): + response = test_utils.portmapping_request("XPDR-C1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + mapping_list = res['nodes'][0]['mapping'] + for mapping in mapping_list: + if mapping['logical-connection-point'] == 'XPDR1-NETWORK1': + self.assertEqual(mapping['port-oper-state'], 'OutOfService', + "Operational State should be 'OutOfService'") + self.assertEqual(mapping['port-admin-state'], 'OutOfService', + "Administrative State should be 'OutOfService'") + else: + self.assertEqual(mapping['port-oper-state'], 'InService', + "Operational State should be 'InService'") + self.assertEqual(mapping['port-admin-state'], 'InService', + "Administrative State should be 'InService'") + time.sleep(1) + + def test_16_check_update_openroadm_topo(self): + url = test_utils.URL_CONFIG_ORDM_TOPO + response = test_utils.get_request(url) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + node_list = res['network'][0]['node'] + nb_updated_tp = 0 + for node in node_list: + self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(node['org-openroadm-common-network:administrative-state'], 'inService') + tp_list = node['ietf-network-topology:termination-point'] + for tp in tp_list: + if node['node-id'] == 'XPDR-C1-XPDR1' and tp['tp-id'] == 'XPDR1-NETWORK1': + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_tp += 1 + else: + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified") + + link_list = res['network'][0]['ietf-network-topology:link'] + updated_links = ['XPDR-C1-XPDR1-XPDR1-NETWORK1toROADM-C1-SRG1-SRG1-PP1-TXRX', + 'ROADM-C1-SRG1-SRG1-PP1-TXRXtoXPDR-C1-XPDR1-XPDR1-NETWORK1'] + nb_updated_link = 0 + for link in link_list: + if link['link-id'] in updated_links: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_link += 1 + else: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_link, 2, "Only two xponder-output/input links should have been modified") + time.sleep(1) + + def test_17_check_update_tapi_neps(self): + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+OTSi") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + nb_updated_neps = 0 + for nep in nep_list: + if 'XPDR1-NETWORK1' in nep['name'][0]['value']: + self.assertEqual(nep['operational-state'], 'DISABLED', + "Operational State should be 'DISABLED'") + self.assertEqual(nep['administrative-state'], 'LOCKED', + "Administrative State should be 'LOCKED'") + nb_updated_neps += 1 + else: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+DSR") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + for nep in nep_list: + if 'XPDR1-NETWORK1' in nep['name'][0]['value']: + self.assertEqual(nep['operational-state'], 'DISABLED', + "Operational State should be 'DISABLED'") + self.assertEqual(nep['administrative-state'], 'LOCKED', + "Administrative State should be 'LOCKED'") + nb_updated_neps += 1 + else: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + self.assertEqual(nb_updated_neps, 4, "Only two xponder neps should have been modified") + time.sleep(1) + + def test_18_check_update_tapi_links(self): + response = test_utils.tapi_get_topology_details_request("T0 - Full Multi-layer topology") + time.sleep(2) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + link_list = res['output']['topology']['link'] + nb_updated_link = 0 + for link in link_list: + if all(x in link['name'][0]['value'] for x in ['XPDR-C1-XPDR1', 'XPDR1-NETWORK1']): + self.assertEqual(link['operational-state'], 'DISABLED') + self.assertEqual(link['administrative-state'], 'LOCKED') + nb_updated_link += 1 + else: + self.assertEqual(link['operational-state'], 'ENABLED') + self.assertEqual(link['administrative-state'], 'UNLOCKED') + self.assertEqual(nb_updated_link, 2, + "Only two xponder-output/input & xponder-transi links should have been modified") + time.sleep(1) + + def test_19_check_update_service_Ethernet(self): + response = test_utils.get_service_list_request( + "services/" + str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual(res['services'][0]['operational-state'], 'outOfService') + self.assertEqual(res['services'][0]['administrative-state'], 'inService') + time.sleep(1) + + def test_20_check_update_connectivity_service_Ethernet(self): + response = test_utils.tapi_get_connectivity_request(str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['output']['service']['operational-state'], 'DISABLED') + self.assertEqual( + res['output']['service']['administrative-state'], 'LOCKED') + time.sleep(1) + + def test_21_restore_status_line_port_xpdrc(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/1%2F0%2F1-PLUG-NET/ports/1" + body = {"ports": [{ + "port-name": "1", + "port-type": "CFP2", + "administrative-state": "inService", + "port-qual": "xpdr-network"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8144/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_22_check_update_portmapping_ok(self): + response = test_utils.portmapping_request("XPDR-C1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + mapping_list = res['nodes'][0]['mapping'] + for mapping in mapping_list: + self.assertEqual(mapping['port-oper-state'], 'InService', + "Operational State should be 'InService'") + self.assertEqual(mapping['port-admin-state'], 'InService', + "Administrative State should be 'InService'") + time.sleep(1) + + def test_23_check_update_openroadm_topo_ok(self): + url = test_utils.URL_CONFIG_ORDM_TOPO + response = test_utils.get_request(url) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + node_list = res['network'][0]['node'] + for node in node_list: + self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(node['org-openroadm-common-network:administrative-state'], 'inService') + tp_list = node['ietf-network-topology:termination-point'] + for tp in tp_list: + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService') + + link_list = res['network'][0]['ietf-network-topology:link'] + for link in link_list: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'inService') + time.sleep(1) + + def test_24_check_update_tapi_neps_ok(self): + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+OTSi") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + for nep in nep_list: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "XPDR-C1-XPDR1+DSR") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + for nep in nep_list: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + time.sleep(1) + + def test_25_check_update_tapi_links_ok(self): + response = test_utils.tapi_get_topology_details_request( + "T0 - Full Multi-layer topology") + time.sleep(2) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + link_list = res['output']['topology']['link'] + for link in link_list: + self.assertEqual(link['operational-state'], 'ENABLED') + self.assertEqual(link['administrative-state'], 'UNLOCKED') + + time.sleep(1) + + def test_26_check_update_service1_ok(self): + self.test_12_get_service_Ethernet() + + def test_27_check_update_connectivity_service_Ethernet_ok(self): + self.test_13_get_connectivity_service_Ethernet() + + def test_28_change_status_port_roadma_srg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C1" + body = {"ports": [{ + "port-name": "C1", + "logical-connection-point": "SRG1-PP1", + "port-type": "client", + "circuit-id": "SRG1", + "administrative-state": "outOfService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_29_check_update_portmapping(self): + response = test_utils.portmapping_request("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + mapping_list = res['nodes'][0]['mapping'] + for mapping in mapping_list: + if mapping['logical-connection-point'] == 'SRG1-PP1-TXRX': + self.assertEqual(mapping['port-oper-state'], 'OutOfService', + "Operational State should be 'OutOfService'") + self.assertEqual(mapping['port-admin-state'], 'OutOfService', + "Administrative State should be 'OutOfService'") + else: + self.assertEqual(mapping['port-oper-state'], 'InService', + "Operational State should be 'InService'") + self.assertEqual(mapping['port-admin-state'], 'InService', + "Administrative State should be 'InService'") + time.sleep(1) + + def test_30_check_update_openroadm_topo(self): + url = test_utils.URL_CONFIG_ORDM_TOPO + response = test_utils.get_request(url) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + node_list = res['network'][0]['node'] + nb_updated_tp = 0 + for node in node_list: + self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(node['org-openroadm-common-network:administrative-state'], 'inService') + tp_list = node['ietf-network-topology:termination-point'] + for tp in tp_list: + if node['node-id'] == 'ROADM-A1-SRG1' and tp['tp-id'] == 'SRG1-PP1-TXRX': + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_tp += 1 + else: + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified") + + link_list = res['network'][0]['ietf-network-topology:link'] + updated_links = ['XPDR-A1-XPDR1-XPDR1-NETWORK1toROADM-A1-SRG1-SRG1-PP1-TXRX', + 'ROADM-A1-SRG1-SRG1-PP1-TXRXtoXPDR-A1-XPDR1-XPDR1-NETWORK1'] + nb_updated_link = 0 + for link in link_list: + if link['link-id'] in updated_links: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_link += 1 + else: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_link, 2, "Only two xponder-output/input links should have been modified") + time.sleep(1) + + def test_31_check_update_tapi_neps(self): + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + nb_updated_neps = 0 + for nep in nep_list: + if 'SRG1-PP1-TXRX' in nep['name'][0]['value']: + self.assertEqual(nep['operational-state'], 'DISABLED', + "Operational State should be 'DISABLED'") + self.assertEqual(nep['administrative-state'], 'LOCKED', + "Administrative State should be 'LOCKED'") + nb_updated_neps += 1 + else: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + self.assertEqual(nb_updated_neps, 3, "Only three roadm neps should have been modified") + time.sleep(1) + + def test_32_check_update_tapi_links(self): + response = test_utils.tapi_get_topology_details_request( + "T0 - Full Multi-layer topology") + time.sleep(2) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + link_list = res['output']['topology']['link'] + nb_updated_link = 0 + for link in link_list: + if all(x in link['name'][0]['value'] for x in ['ROADM-A1', 'SRG1-PP1-TXRX']): + self.assertEqual(link['operational-state'], 'DISABLED') + self.assertEqual(link['administrative-state'], 'LOCKED') + nb_updated_link += 1 + else: + self.assertEqual(link['operational-state'], 'ENABLED') + self.assertEqual(link['administrative-state'], 'UNLOCKED') + self.assertEqual(nb_updated_link, 1, + "Only one xponder-output/input link should have been modified") + time.sleep(1) + + def test_33_check_update_service_Ethernet(self): + self.test_19_check_update_service_Ethernet() + + def test_34_check_update_connectivity_service_Ethernet(self): + self.test_20_check_update_connectivity_service_Ethernet() + + def test_35_restore_status_port_roadma_srg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C1" + body = {"ports": [{ + "port-name": "C1", + "logical-connection-point": "SRG1-PP1", + "port-type": "client", + "circuit-id": "SRG1", + "administrative-state": "inService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_36_check_update_portmapping_ok(self): + response = test_utils.portmapping_request("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + mapping_list = res['nodes'][0]['mapping'] + for mapping in mapping_list: + self.assertEqual(mapping['port-oper-state'], 'InService', + "Operational State should be 'InService'") + self.assertEqual(mapping['port-admin-state'], 'InService', + "Administrative State should be 'InService'") + time.sleep(1) + + def test_37_check_update_openroadm_topo_ok(self): + self.test_23_check_update_openroadm_topo_ok() + + def test_38_check_update_tapi_neps_ok(self): + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + for nep in nep_list: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + + time.sleep(1) + + def test_39_check_update_tapi_links_ok(self): + self.test_25_check_update_tapi_links_ok() + + def test_40_check_update_service1_ok(self): + self.test_12_get_service_Ethernet() + + def test_41_check_update_connectivity_service_Ethernet_ok(self): + self.test_13_get_connectivity_service_Ethernet() + + def test_42_change_status_line_port_roadma_deg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/2%2F0/ports/L1" + body = {"ports": [{ + "port-name": "L1", + "logical-connection-point": "DEG2-TTP-TXRX", + "port-type": "LINE", + "circuit-id": "1", + "administrative-state": "outOfService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_43_check_update_portmapping(self): + response = test_utils.portmapping_request("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + mapping_list = res['nodes'][0]['mapping'] + for mapping in mapping_list: + if mapping['logical-connection-point'] == 'DEG2-TTP-TXRX': + self.assertEqual(mapping['port-oper-state'], 'OutOfService', + "Operational State should be 'OutOfService'") + self.assertEqual(mapping['port-admin-state'], 'OutOfService', + "Administrative State should be 'OutOfService'") + else: + self.assertEqual(mapping['port-oper-state'], 'InService', + "Operational State should be 'InService'") + self.assertEqual(mapping['port-admin-state'], 'InService', + "Administrative State should be 'InService'") + time.sleep(1) + + def test_44_check_update_openroadm_topo(self): + url = test_utils.URL_CONFIG_ORDM_TOPO + response = test_utils.get_request(url) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + node_list = res['network'][0]['node'] + nb_updated_tp = 0 + for node in node_list: + self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(node['org-openroadm-common-network:administrative-state'], 'inService') + tp_list = node['ietf-network-topology:termination-point'] + for tp in tp_list: + if node['node-id'] == 'ROADM-A1-DEG2' and tp['tp-id'] == 'DEG2-TTP-TXRX': + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_tp += 1 + else: + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified") + + link_list = res['network'][0]['ietf-network-topology:link'] + updated_links = ['ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX', + 'ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX'] + nb_updated_link = 0 + for link in link_list: + if link['link-id'] in updated_links: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_link += 1 + else: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_link, 2, "Only two xponder-output/input links should have been modified") + time.sleep(1) + + def test_45_check_update_tapi_neps(self): + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + nb_updated_neps = 0 + for nep in nep_list: + if 'DEG2-TTP-TXRX' in nep['name'][0]['value']: + self.assertEqual(nep['operational-state'], 'DISABLED', + "Operational State should be 'DISABLED'") + self.assertEqual(nep['administrative-state'], 'LOCKED', + "Administrative State should be 'LOCKED'") + nb_updated_neps += 1 + else: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + self.assertEqual(nb_updated_neps, 3, "Only three roadm neps should have been modified") + time.sleep(1) + + def test_46_check_update_tapi_links(self): + response = test_utils.tapi_get_topology_details_request( + "T0 - Full Multi-layer topology") + time.sleep(2) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + link_list = res['output']['topology']['link'] + nb_updated_link = 0 + for link in link_list: + if all(x in link['name'][0]['value'] for x in ['ROADM-A1', 'DEG2-TTP-TXRX']): + self.assertEqual(link['operational-state'], 'DISABLED') + self.assertEqual(link['administrative-state'], 'LOCKED') + nb_updated_link += 1 + else: + self.assertEqual(link['operational-state'], 'ENABLED') + self.assertEqual(link['administrative-state'], 'UNLOCKED') + self.assertEqual(nb_updated_link, 1, + "Only one rdm-rdm link should have been modified") + time.sleep(1) + + def test_47_check_update_service_Ethernet(self): + self.test_19_check_update_service_Ethernet() + + def test_48_check_update_connectivity_service_Ethernet(self): + self.test_20_check_update_connectivity_service_Ethernet() + + def test_49_restore_status_line_port_roadma_deg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/2%2F0/ports/L1" + body = {"ports": [{ + "port-name": "L1", + "logical-connection-point": "DEG2-TTP-TXRX", + "port-type": "LINE", + "circuit-id": "1", + "administrative-state": "inService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_50_check_update_portmapping_ok(self): + self.test_36_check_update_portmapping_ok() + + def test_51_check_update_openroadm_topo_ok(self): + self.test_23_check_update_openroadm_topo_ok() + + def test_52_check_update_tapi_neps_ok(self): + self.test_38_check_update_tapi_neps_ok() + + def test_53_check_update_tapi_links_ok(self): + self.test_25_check_update_tapi_links_ok() + + def test_54_check_update_service1_ok(self): + self.test_12_get_service_Ethernet() + + def test_55_check_update_connectivity_service_Ethernet_ok(self): + self.test_13_get_connectivity_service_Ethernet() + + def test_56_change_status_port_roadma_srg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C2" + body = {"ports": [{ + "port-name": "C2", + "logical-connection-point": "SRG1-PP2", + "port-type": "client", + "circuit-id": "SRG1", + "administrative-state": "outOfService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + time.sleep(2) + + def test_57_check_update_portmapping(self): + response = test_utils.portmapping_request("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + mapping_list = res['nodes'][0]['mapping'] + for mapping in mapping_list: + if mapping['logical-connection-point'] == 'SRG1-PP2-TXRX': + self.assertEqual(mapping['port-oper-state'], 'OutOfService', + "Operational State should be 'OutOfService'") + self.assertEqual(mapping['port-admin-state'], 'OutOfService', + "Administrative State should be 'OutOfService'") + else: + self.assertEqual(mapping['port-oper-state'], 'InService', + "Operational State should be 'InService'") + self.assertEqual(mapping['port-admin-state'], 'InService', + "Administrative State should be 'InService'") + time.sleep(1) + + def test_58_check_update_openroadm_topo(self): + url = test_utils.URL_CONFIG_ORDM_TOPO + response = test_utils.get_request(url) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + node_list = res['network'][0]['node'] + nb_updated_tp = 0 + for node in node_list: + self.assertEqual(node['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(node['org-openroadm-common-network:administrative-state'], 'inService') + tp_list = node['ietf-network-topology:termination-point'] + for tp in tp_list: + if node['node-id'] == 'ROADM-A1-SRG1' and tp['tp-id'] == 'SRG1-PP2-TXRX': + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'outOfService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'outOfService') + nb_updated_tp += 1 + else: + self.assertEqual(tp['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(tp['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_tp, 1, "Only one termination-point should have been modified") + + link_list = res['network'][0]['ietf-network-topology:link'] + nb_updated_link = 0 + for link in link_list: + self.assertEqual(link['org-openroadm-common-network:operational-state'], 'inService') + self.assertEqual(link['org-openroadm-common-network:administrative-state'], 'inService') + self.assertEqual(nb_updated_link, 0, "No link should have been modified") + time.sleep(1) + + def test_59_check_update_tapi_neps(self): + response = test_utils.tapi_get_node_details_request("T0 - Full Multi-layer topology", "ROADM-A1+PHOTONIC_MEDIA") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + nep_list = res['output']['node']['owned-node-edge-point'] + nb_updated_neps = 0 + for nep in nep_list: + if 'SRG1-PP2-TXRX' in nep['name'][0]['value']: + self.assertEqual(nep['operational-state'], 'DISABLED', + "Operational State should be 'DISABLED'") + self.assertEqual(nep['administrative-state'], 'LOCKED', + "Administrative State should be 'LOCKED'") + nb_updated_neps += 1 + else: + self.assertEqual(nep['operational-state'], 'ENABLED', + "Operational State should be 'ENABLED'") + self.assertEqual(nep['administrative-state'], 'UNLOCKED', + "Administrative State should be 'UNLOCKED'") + self.assertEqual(nb_updated_neps, 3, "Only three roadm neps should have been modified") + time.sleep(1) + + def test_60_check_update_tapi_links(self): + response = test_utils.tapi_get_topology_details_request( + "T0 - Full Multi-layer topology") + time.sleep(2) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + link_list = res['output']['topology']['link'] + nb_updated_link = 0 + for link in link_list: + if all(x in link['name'][0]['value'] for x in ['ROADM-A1', 'SRG1-PP2-TXRX']): + self.assertEqual(link['operational-state'], 'DISABLED') + self.assertEqual(link['administrative-state'], 'LOCKED') + nb_updated_link += 1 + else: + self.assertEqual(link['operational-state'], 'ENABLED') + self.assertEqual(link['administrative-state'], 'UNLOCKED') + self.assertEqual(nb_updated_link, 0, + "No link should have been modified") + time.sleep(1) + + def test_61_check_update_service1_ok(self): + self.test_12_get_service_Ethernet() + + def test_62_check_update_connectivity_service_Ethernet_ok(self): + self.test_13_get_connectivity_service_Ethernet() + + def test_63_delete_connectivity_service_Ethernet(self): + response = test_utils.tapi_delete_connectivity_request(str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.no_content) + time.sleep(self.WAITING) + + def test_64_disconnect_xponders_from_roadm(self): + url = "{}/config/ietf-network:networks/network/openroadm-topology/ietf-network-topology:link/" + response = test_utils.get_ordm_topo_request("") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + links = res['network'][0]['ietf-network-topology:link'] + for link in links: + if link["org-openroadm-common-network:link-type"] in ('XPONDER-OUTPUT', 'XPONDER-INPUT'): + link_name = link["link-id"] + response = test_utils.delete_request(url+link_name) + self.assertEqual(response.status_code, requests.codes.ok) + + def test_65_disconnect_XPDRA(self): + response = test_utils.unmount_device("XPDR-A1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + def test_66_disconnect_XPDRC(self): + response = test_utils.unmount_device("XPDR-C1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + def test_67_disconnect_ROADMA(self): + response = test_utils.unmount_device("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + def test_68_disconnect_ROADMC(self): + response = test_utils.unmount_device("ROADM-C1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py b/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py new file mode 100644 index 000000000..d66f5e240 --- /dev/null +++ b/tests/transportpce_tests/with_docker/test03_tapi_nbinotifications.py @@ -0,0 +1,421 @@ +#!/usr/bin/env python +############################################################################## +# Copyright (c) 2020 Orange, Inc. and others. All rights reserved. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# pylint: disable=no-member +# pylint: disable=too-many-public-methods + +import os +import json +# pylint: disable=wrong-import-order +import sys +import unittest +import time +import requests +sys.path.append('transportpce_tests/common/') +# pylint: disable=wrong-import-position +# pylint: disable=import-error +import test_utils # nopep8 + + +# pylint: disable=too-few-public-methods +class UuidServices: + def __init__(self): + # pylint: disable=invalid-name + self.pm = None + self.odu = None + self.dsr = None + self.eth = None + + +# pylint: disable=too-few-public-methods +class UuidSubscriptions: + def __init__(self): + # pylint: disable=invalid-name + self.pm = None + self.odu = None + self.dsr = None + self.eth = None + + +class TransportNbiNotificationstesting(unittest.TestCase): + cr_serv_sample_data = { + "input": { + "end-point": [ + { + "layer-protocol-name": "DSR", + "service-interface-point": { + "service-interface-point-uuid": "b1f4bd3b-7fa9-367b-a8ab-6e80293238df" + }, + "administrative-state": "UNLOCKED", + "operational-state": "ENABLED", + "direction": "BIDIRECTIONAL", + "role": "SYMMETRIC", + "protection-role": "WORK", + "local-id": "XPDR-C1-XPDR1", + "name": [ + { + "value-name": "OpenROADM node id", + "value": "XPDR-C1-XPDR1" + } + ] + }, + { + "layer-protocol-name": "DSR", + "service-interface-point": { + "service-interface-point-uuid": "b5964ce9-274c-3f68-b4d1-83c0b61bc74e" + }, + "administrative-state": "UNLOCKED", + "operational-state": "ENABLED", + "direction": "BIDIRECTIONAL", + "role": "SYMMETRIC", + "protection-role": "WORK", + "local-id": "XPDR-A1-XPDR1", + "name": [ + { + "value-name": "OpenROADM node id", + "value": "XPDR-A1-XPDR1" + } + ] + } + ], + "connectivity-constraint": { + "service-layer": "ETH", + "service-type": "POINT_TO_POINT_CONNECTIVITY", + "service-level": "Some service-level", + "requested-capacity": { + "total-size": { + "value": "100", + "unit": "GB" + } + } + }, + "state": "Some state" + } + } + + cr_notif_subs_sample_data = { + "input": { + "subscription-filter": { + "requested-notification-types": [ + "ALARM_EVENT" + ], + "requested-object-types": [ + "CONNECTIVITY_SERVICE" + ], + "requested-layer-protocols": [ + "ETH" + ], + "requested-object-identifier": [ + "76d8f07b-ead5-4132-8eb8-cf3fdef7e079" + ], + "include-content": True, + "local-id": "localId", + "name": [ + { + "value-name": "Subscription name", + "value": "test subscription" + } + ] + }, + "subscription-state": "ACTIVE" + } + } + + cr_get_notif_list_sample_data = { + "input": { + "subscription-id-or-name": "c07e7fd1-0377-4fbf-8928-36c17b0d0d68", + "time-period": "time-period" + } + } + + processes = [] + uuid_services = UuidServices() + uuid_subscriptions = UuidSubscriptions() + WAITING = 25 # nominal value is 300 + NODE_VERSION_221 = '2.2.1' + + @classmethod + def setUpClass(cls): + # pylint: disable=unsubscriptable-object + # TODO: for lighty manage the activation of NBI notification feature + cls.init_failed_nbi = False + cls.init_failed_tapi = False + os.environ['JAVA_MIN_MEM'] = '1024M' + os.environ['JAVA_MAX_MEM'] = '4096M' + cls.processes = test_utils.start_tpce() + # NBI notification feature is not installed by default in Karaf + if "USE_LIGHTY" not in os.environ or os.environ['USE_LIGHTY'] != 'True': + print("installing NBI notification feature...") + result = test_utils.install_karaf_feature("odl-transportpce-nbinotifications") + if result.returncode != 0: + cls.init_failed_nbi = True + print("installing tapi feature...") + result = test_utils.install_karaf_feature("odl-transportpce-tapi") + if result.returncode != 0: + cls.init_failed_tapi = True + print("Restarting OpenDaylight...") + test_utils.shutdown_process(cls.processes[0]) + cls.processes[0] = test_utils.start_karaf() + test_utils.process_list[0] = cls.processes[0] + cls.init_failed = not test_utils.wait_until_log_contains( + test_utils.KARAF_LOG, test_utils.KARAF_OK_START_MSG, time_to_wait=60) + if cls.init_failed_nbi: + print("NBI notification installation feature failed...") + test_utils.shutdown_process(cls.processes[0]) + sys.exit(2) + if cls.init_failed_tapi: + print("tapi installation feature failed...") + test_utils.shutdown_process(cls.processes[0]) + sys.exit(2) + cls.processes = test_utils.start_sims([('xpdra', cls.NODE_VERSION_221), + ('roadma', cls.NODE_VERSION_221), + ('roadmc', cls.NODE_VERSION_221), + ('xpdrc', cls.NODE_VERSION_221)]) + + @classmethod + def tearDownClass(cls): + # pylint: disable=not-an-iterable + for process in cls.processes: + test_utils.shutdown_process(process) + print("all processes killed") + + def setUp(self): # instruction executed before each test method + # pylint: disable=consider-using-f-string + print("execution of {}".format(self.id().split(".")[-1])) + + def test_01_connect_xpdrA(self): + response = test_utils.mount_device("XPDR-A1", ('xpdra', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_02_connect_xpdrC(self): + response = test_utils.mount_device("XPDR-C1", ('xpdrc', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_03_connect_rdmA(self): + response = test_utils.mount_device("ROADM-A1", ('roadma', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_04_connect_rdmC(self): + response = test_utils.mount_device("ROADM-C1", ('roadmc', self.NODE_VERSION_221)) + self.assertEqual(response.status_code, requests.codes.created, test_utils.CODE_SHOULD_BE_201) + + def test_05_connect_xprdA_N1_to_roadmA_PP1(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-A1", "1", "1", + "ROADM-A1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) + time.sleep(2) + + def test_06_connect_roadmA_PP1_to_xpdrA_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-A1", "1", "1", + "ROADM-A1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) + time.sleep(2) + + def test_07_connect_xprdC_N1_to_roadmC_PP1(self): + response = test_utils.connect_xpdr_to_rdm_request("XPDR-C1", "1", "1", + "ROADM-C1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Xponder Roadm Link created successfully', res["output"]["result"]) + time.sleep(2) + + def test_08_connect_roadmC_PP1_to_xpdrC_N1(self): + response = test_utils.connect_rdm_to_xpdr_request("XPDR-C1", "1", "1", + "ROADM-C1", "1", "SRG1-PP1-TXRX") + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertIn('Roadm Xponder links created successfully', res["output"]["result"]) + time.sleep(2) + + def test_09_add_omsAttributes_ROADMA_ROADMC(self): + # Config ROADMA-ROADMC oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-A1-DEG2-DEG2-TTP-TXRXtoROADM-C1-DEG1-DEG1-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + def test_10_add_omsAttributes_ROADMC_ROADMA(self): + # Config ROADMC-ROADMA oms-attributes + data = {"span": { + "auto-spanloss": "true", + "spanloss-base": 11.4, + "spanloss-current": 12, + "engineered-spanloss": 12.2, + "link-concatenation": [{ + "SRLG-Id": 0, + "fiber-type": "smf", + "SRLG-length": 100000, + "pmd": 0.5}]}} + response = test_utils.add_oms_attr_request("ROADM-C1-DEG1-DEG1-TTP-TXRXtoROADM-A1-DEG2-DEG2-TTP-TXRX", data) + self.assertEqual(response.status_code, requests.codes.created) + + # test service-create for Eth service from xpdr to xpdr + def test_11_create_connectivity_service_Ethernet(self): + response = test_utils.tapi_create_connectivity_request(self.cr_serv_sample_data) + time.sleep(self.WAITING) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.uuid_services.eth = res['output']['service']['uuid'] + # pylint: disable=consider-using-f-string + + input_dict_1 = {'administrative-state': 'LOCKED', + 'lifecycle-state': 'PLANNED', + 'operational-state': 'DISABLED', + 'service-type': 'POINT_TO_POINT_CONNECTIVITY', + 'service-layer': 'ETH', + 'connectivity-direction': 'BIDIRECTIONAL' + } + input_dict_2 = {'value-name': 'OpenROADM node id', + 'value': 'XPDR-C1-XPDR1'} + input_dict_3 = {'value-name': 'OpenROADM node id', + 'value': 'XPDR-A1-XPDR1'} + + self.assertDictEqual(dict(input_dict_1, **res['output']['service']), + res['output']['service']) + self.assertDictEqual(dict(input_dict_2, **res['output']['service']['end-point'][0]['name'][0]), + res['output']['service']['end-point'][0]['name'][0]) + self.assertDictEqual(dict(input_dict_3, **res['output']['service']['end-point'][1]['name'][0]), + res['output']['service']['end-point'][1]['name'][0]) + # If the gate fails is because of the waiting time not being enough + time.sleep(self.WAITING) + + def test_12_get_service_Ethernet(self): + response = test_utils.get_service_list_request("services/" + str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['services'][0]['administrative-state'], 'inService') + self.assertEqual( + res['services'][0]['service-name'], self.uuid_services.eth) + self.assertEqual( + res['services'][0]['connection-type'], 'service') + self.assertEqual( + res['services'][0]['lifecycle-state'], 'planned') + time.sleep(2) + + def test_13_get_connectivity_service_Ethernet(self): + response = test_utils.tapi_get_connectivity_request(str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual( + res['output']['service']['operational-state'], 'ENABLED') + self.assertEqual( + res['output']['service']['name'][0]['value'], self.uuid_services.eth) + self.assertEqual( + res['output']['service']['administrative-state'], 'UNLOCKED') + self.assertEqual( + res['output']['service']['lifecycle-state'], 'INSTALLED') + time.sleep(2) + + def test_14_create_notifications_subscription_service(self): + self.cr_notif_subs_sample_data["input"]["subscription-filter"]["requested-object-identifier"][0] = str( + self.uuid_services.eth) + response = test_utils.tapi_create_notification_subscription_service_request(self.cr_notif_subs_sample_data) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.uuid_subscriptions.eth = res['output']['subscription-service']['uuid'] + self.assertEqual(res['output']['subscription-service']['subscription-filter'] + ['requested-object-types'][0], 'CONNECTIVITY_SERVICE') + self.assertEqual(res['output']['subscription-service']['subscription-filter'] + ['requested-notification-types'][0], 'ALARM_EVENT') + self.assertEqual(res['output']['subscription-service']['subscription-filter'] + ['requested-object-identifier'][0], str(self.uuid_services.eth)) + time.sleep(2) + + def test_15_change_status_port_roadma_srg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C1" + body = {"ports": [{ + "port-name": "C1", + "logical-connection-point": "SRG1-PP1", + "port-type": "client", + "circuit-id": "SRG1", + "administrative-state": "outOfService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + # If the gate fails is because of the waiting time not being enough + time.sleep(2) + + def test_16_get_tapi_notifications_connectivity_service_Ethernet(self): + self.cr_get_notif_list_sample_data["input"]["subscription-id-or-name"] = str(self.uuid_subscriptions.eth) + response = test_utils.tapi_get_notifications_list_request(self.cr_get_notif_list_sample_data) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual(res['output']['notification'][0]['target-object-identifier'], str(self.uuid_services.eth)) + self.assertEqual(res['output']['notification'][0]['target-object-type'], 'CONNECTIVITY_SERVICE') + self.assertEqual(res['output']['notification'][0]['changed-attributes'][0]['new-value'], 'LOCKED') + self.assertEqual(res['output']['notification'][0]['changed-attributes'][1]['new-value'], 'DISABLED') + time.sleep(2) + + def test_17_restore_status_port_roadma_srg(self): + url = "{}/config/org-openroadm-device:org-openroadm-device/circuit-packs/3%2F0/ports/C1" + body = {"ports": [{ + "port-name": "C1", + "logical-connection-point": "SRG1-PP1", + "port-type": "client", + "circuit-id": "SRG1", + "administrative-state": "inService", + "port-qual": "roadm-external"}]} + response = requests.request("PUT", url.format("http://127.0.0.1:8141/restconf"), + data=json.dumps(body), headers=test_utils.TYPE_APPLICATION_JSON, + auth=(test_utils.ODL_LOGIN, test_utils.ODL_PWD)) + self.assertEqual(response.status_code, requests.codes.ok) + # If the gate fails is because of the waiting time not being enough + time.sleep(2) + + def test_18_get_tapi_notifications_connectivity_service_Ethernet(self): + self.cr_get_notif_list_sample_data["input"]["subscription-id-or-name"] = str(self.uuid_subscriptions.eth) + response = test_utils.tapi_get_notifications_list_request(self.cr_get_notif_list_sample_data) + self.assertEqual(response.status_code, requests.codes.ok) + res = response.json() + self.assertEqual(res['output']['notification'][1]['target-object-identifier'], str(self.uuid_services.eth)) + self.assertEqual(res['output']['notification'][1]['target-object-type'], 'CONNECTIVITY_SERVICE') + self.assertEqual(res['output']['notification'][1]['changed-attributes'][0]['new-value'], 'UNLOCKED') + self.assertEqual(res['output']['notification'][1]['changed-attributes'][1]['new-value'], 'ENABLED') + time.sleep(2) + + def test_19_delete_connectivity_service_Ethernet(self): + response = test_utils.tapi_delete_connectivity_request(str(self.uuid_services.eth)) + self.assertEqual(response.status_code, requests.codes.no_content) + time.sleep(self.WAITING) + + def test_20_disconnect_XPDRA(self): + response = test_utils.unmount_device("XPDR-A1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + def test_21_disconnect_XPDRC(self): + response = test_utils.unmount_device("XPDR-C1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + def test_22_disconnect_ROADMA(self): + response = test_utils.unmount_device("ROADM-A1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + def test_23_disconnect_ROADMC(self): + response = test_utils.unmount_device("ROADM-C1") + self.assertEqual(response.status_code, requests.codes.ok, test_utils.CODE_SHOULD_BE_200) + + +if __name__ == "__main__": + unittest.main(verbosity=2) diff --git a/tox.ini b/tox.ini index b290f7938..20a4e0274 100644 --- a/tox.ini +++ b/tox.ini @@ -203,6 +203,7 @@ passenv = LAUNCHER USE_LIGHTY USE_ODL_RESTCONF_VERSION OLM_TIMER1 OLM_TIMER2 setenv = OLM_TIMER1=3000 OLM_TIMER2=2000 + INSTALL_TAPI=True INSTALL_NBINOTIFICATIONS=True commands =