Use network-topology model for notification tests 24/101424/5
authorSangwook Ha <sangwook.ha@verizon.com>
Thu, 2 Jun 2022 03:47:40 +0000 (20:47 -0700)
committerSangwook Ha <sangwook.ha@verizon.com>
Thu, 2 Jun 2022 06:32:22 +0000 (23:32 -0700)
opendaylight-inventory.yang is only available from openflowplugin,
making netconf notification tests depend on the openflowplugin feature.
Use network-topology.yang instead to avoid the dependecy issue when
KARAF_VERSION is set to 'netconf'.

Change-Id: I4aecc6c1ea38eaedaf85b44dae625dd0d54177b8
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
csit/suites/netconf/notifications/notifications_basic.robot
csit/suites/netconf/notifications/templates/config_data.xml
csit/suites/netconf/notifications/templates/subscribe.xml
tools/wstools/ssereceiver.py

index ed3c7bfb889255a0ec8ea28caab50ab27457f6f1..ad7bebc76c3a835a1fbc58b5ffee1fde245d3526 100644 (file)
@@ -48,7 +48,7 @@ Resource          ${CURDIR}/../../../variables/Variables.robot
 ${TEMPLATE_FOLDER}    ${CURDIR}/templates
 ${DRAFT_STREAMS_URI}    restconf/streams
 ${RFC8040_STREAMS_URI}    rests/data/ietf-restconf-monitoring:restconf-state/streams
-${NODES_STREAM_PATH}    opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE
+${NODES_STREAM_PATH}    network-topology:network-topology/datastore=CONFIGURATION/scope=BASE
 ${DRAFT_DCN_STREAM_URI}    ${DRAFT_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH}
 ${RFC8040_DCN_STREAM_URI}    ${RFC8040_STREAMS_URI}/stream/data-change-event-subscription/${NODES_STREAM_PATH}
 ${RESTCONF_SUBSCRIBE_DATA}    subscribe.xml
@@ -94,7 +94,7 @@ List_DCN_Streams
 Start_Receiver
     [Documentation]    Start the websocket listener
     ${output} =    BuiltIn.Run_Keyword_If    "${USE_RFC8040}" == "False"    SSHLibrary.Write    python wsreceiver.py --uri ${location} --count 2 --logfile ${RECEIVER_LOG_FILE} ${RECEIVER_OPTIONS}
-    ...    ELSE    SSHLibrary.Write    python3 ssereceiver.py --controller ${ODL_SYSTEM_IP} --logfile ${RECEIVER_LOG_FILE}
+    ...    ELSE    SSHLibrary.Write    python3 ssereceiver.py --uri ${location} --logfile ${RECEIVER_LOG_FILE}
     BuiltIn.Log    ${output}
     ${output} =    SSHLibrary.Read    delay=2s
     BuiltIn.Log    ${output}
@@ -103,11 +103,13 @@ Change_DS_Config
     [Documentation]    Make a change in DS configuration.
     [Tags]    critical
     ${body} =    OperatingSystem.Get_File    ${TEMPLATE_FOLDER}/${RESTCONF_CONFIG_DATA}
-    ${uri} =    BuiltIn.Set_Variable_If    "${USE_RFC8040}" == "False"    /restconf/config    /rests/data
-    ${resp} =    RequestsLibrary.Post_Request    restconf    ${uri}    headers=${SEND_ACCEPT_XML_HEADERS}    data=${body}
+    ${uri} =    BuiltIn.Set_Variable_If    "${USE_RFC8040}" == "False"    /restconf/config/network-topology:network-topology
+    ...    /rests/data/network-topology:network-topology
+    ${resp} =    RequestsLibrary.Put_Request    restconf    ${uri}    headers=${SEND_ACCEPT_XML_HEADERS}    data=${body}
     Log_Response    ${resp}
     BuiltIn.Should_Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
-    ${uri} =    Restconf.Generate URI    opendaylight-inventory:nodes    config
+    ${uri} =    BuiltIn.Set_Variable_If    "${USE_RFC8040}" == "False"    /restconf/config/network-topology:network-topology/topology/netconf-notif
+    ...    /rests/data/network-topology:network-topology/topology=netconf-notif
     ${resp} =    RequestsLibrary.Delete_Request    restconf    ${uri}    headers=${SEND_ACCEPT_XML_HEADERS}
     Log_Response    ${resp}
     BuiltIn.Should_Contain    ${ALLOWED_STATUS_CODES}    ${resp.status_code}
@@ -121,7 +123,7 @@ Check_Notification
     BuiltIn.Should_Contain    ${notification}    <notification xmlns=
     BuiltIn.Should_Contain    ${notification}    <eventTime>
     BuiltIn.Should_Contain    ${notification}    <data-changed-notification xmlns=
-    BuiltIn.Should_Contain    ${notification}    <operation>created</operation>
+    BuiltIn.Should_Contain    ${notification}    <operation>updated</operation>
     BuiltIn.Should_Contain    ${notification}    </data-change-event>
     BuiltIn.Should_Contain    ${notification}    </data-changed-notification>
     BuiltIn.Should_Contain    ${notification}    </notification>
index d64b66dee4fa6f243074c8689d23594d7efcb678..2aedd54931edaa5cdbc0986d5bed8c27ac890dc5 100644 (file)
@@ -1,5 +1,5 @@
-<nodes xmlns="urn:opendaylight:inventory">
-  <node>
-    <id>agent-007</id>
-  </node>
-</nodes>
+<network-topology xmlns="urn:TBD:params:xml:ns:yang:network-topology">
+  <topology>
+    <topology-id>netconf-notif</topology-id>
+  </topology>
+</network-topology>
index cb9eb12581aef89990c2c4d958160d76298eb136..b385dd2ffde57524c742ca7c87b56c48570e4ae5 100644 (file)
@@ -1,5 +1,5 @@
 <input xmlns="urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote">
-  <path xmlns:a="urn:opendaylight:inventory">/a:nodes</path>
+  <path xmlns:a="urn:TBD:params:xml:ns:yang:network-topology">/a:network-topology</path>
   <datastore xmlns="urn:sal:restconf:event:subscription">CONFIGURATION</datastore>
   <scope xmlns="urn:sal:restconf:event:subscription">BASE</scope>
 </input>
index 72752cd63d00d77b081a322a1d9870b31ccefa8f..f3220c089062d4fc5996c9ff64a87f58fcdfe685 100644 (file)
@@ -13,9 +13,7 @@ async def get_events():
     conn = aiohttp.TCPConnector()
     auth = aiohttp.BasicAuth(args.user, args.password)
     client = aiohttp.ClientSession(connector=conn, auth=auth)
-    async with sse_client.EventSource(
-        "http://" + args.controller + ":8181" + args.uri, session=client
-    ) as event_source:
+    async with sse_client.EventSource(args.uri, session=client) as event_source:
         try:
             async for event in event_source:
                 logger.info(event)
@@ -30,10 +28,10 @@ def parse_arguments():
         :return: args object
     """
     parser = argparse.ArgumentParser()
-    parser.add_argument("--controller", default="127.0.0.1", help="Controller IP")
     parser.add_argument(
         "--uri",
-        default="/rests/notif/data-change-event-subscription/opendaylight-inventory:nodes/datastore=CONFIGURATION/scope=BASE",
+        default="http://127.0.0.1:8181/rests/notif/data-change-event-subscription"
+        "/network-topology:network-topology/datastore=CONFIGURATION/scope=BASE",
         help="URI endpoint to connect",
     )
     parser.add_argument(