From ffac18483858fb83e66cd28e197e79cf4ef47516 Mon Sep 17 00:00:00 2001
From: "@abbedsedk" <abbed_sedkaoui@yahoo.fr>
Date: Fri, 22 Oct 2021 13:09:57 +0200
Subject: [PATCH 1/3] odl-pcep-ietf-stateful07 updated to
 odl-pcep-ietf-stateful

as of Opendaylight Aluminium 13.0 new module replacing it

module
https://mvnrepository.com/artifact/org.opendaylight.bgpcep/pcep-ietf-stateful07

replaced by
https://mvnrepository.com/artifact/org.opendaylight.bgpcep/pcep-ietf-stateful
---
 pathman_sr.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/pathman_sr.py b/pathman_sr.py
index 9d43bbb..75afe45 100644
--- a/pathman_sr.py
+++ b/pathman_sr.py
@@ -791,10 +791,10 @@ def list_pcep_lsp(node_list, debug):
                     name = path['name']
                     ip_hoplist = []
                     sid_list = []
-                    if 'odl-pcep-ietf-stateful07:lsp' in path['path'][0].keys():
-                        if 'operational' in path['path'][0]['odl-pcep-ietf-stateful07:lsp'].keys():
-                            oper = path['path'][0]['odl-pcep-ietf-stateful07:lsp']['operational']
-                            # if path['path'][0]['odl-pcep-ietf-stateful07:lsp']['operational'] == 'up':
+                    if 'odl-pcep-ietf-stateful:lsp' in path['path'][0].keys():
+                        if 'operational' in path['path'][0]['odl-pcep-ietf-stateful:lsp'].keys():
+                            oper = path['path'][0]['odl-pcep-ietf-stateful:lsp']['operational']
+                            # if path['path'][0]['odl-pcep-ietf-stateful:lsp']['operational'] == 'up':
                             if oper == 'up' or oper == 'active':
                                 if 'rro' in path['path'][0].keys():
                                     route_obj = path['path'][0]['rro']['subobject']
@@ -982,7 +982,7 @@ def get_pcep_type(debug):
         for node in my_pcep['topology'][0]['node']:
             loopback = node['network-topology-pcep:path-computation-client']['ip-address']
             pcc = node['node-id']
-            if 'odl-pcep-ietf-stateful07:stateful' in node['network-topology-pcep:path-computation-client']['stateful-tlv'].keys():
+            if 'odl-pcep-ietf-stateful:stateful' in node['network-topology-pcep:path-computation-client']['stateful-tlv'].keys():
                 pcep_type = '07'
             else:
                 pcep_type = '02'

From 08416358730da327a2278ff49da85da5dd648748 Mon Sep 17 00:00:00 2001
From: "@abbedsedk" <abbed_sedkaoui@yahoo.fr>
Date: Fri, 22 Oct 2021 13:27:32 +0200
Subject: [PATCH 2/3] as defined in RFC 8664, Rename SR-ERO suboject from
 sid-type to nai-type

https://git.opendaylight.org/gerrit/gitweb?p=bgpcep.git;a=commit;h=5b4952979cb5107a3333027849fec04254385641

this is starting ODL Aluminium 13.0


https://git.opendaylight.org/gerrit/c/bgpcep/+/91507

Update to RFC 8664 (PCEP Segment Routing)

As per RFC 8664, this commit introduces following changes:
 - Add Flags N & X to SR PCE Capability
 - Add Ipv6 Local Nai Type and rename SID Type to NAI Type (NT) in
   odl-pcep-segment-routing-yang
 - Change IANA type (=36) for SR-ERO and SR-RRO to be the default value in
   pcep-segment-routing-app-config.yang instead of Legacy Type values
 - Update yang model revision
 - Turn IANA Type as the defaut for Segement Routing parser registration
 - Mark deprecated all IANA Type configuration (this will be removed in next
   release after Aluminium)
 - Add extra verifications to AbstractSrSubobjectParser Java Class and support
   for Ipv6Local NAI
 - Update accordingly Segment Routing Junit Tests

JIRA: BGPCEP-882
---
 pathman_sr.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/pathman_sr.py b/pathman_sr.py
index 75afe45..a1dbfec 100644
--- a/pathman_sr.py
+++ b/pathman_sr.py
@@ -53,6 +53,8 @@
     20161226, Niklas - ver 5.9h - Multi area/level fix for bgp-ls and sid bug.
     20170202, Niklas - ver 5.9i - Refactored sid_list to sid_saves to avoid duplicate use
     20171013, Niklas - ver 5.9j - Updated odl version lis and checks
+    20212210, Abbed Sedkaoui - 5.9k - Rename odl module Stateful07 -> Stateful
+    20212210, Abbed Sedkaoui - 5.9i - Rename SR-ERO suboject from sid-type to nai-type
     """
 __author__ = 'niklas'
 
@@ -225,7 +227,7 @@
 
 ero_sr_xml = '''<subobject>
        <loose>false</loose>
-       <sid-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">ipv4-node-id</sid-type>
+       <nai-type xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">ipv4-node-id</nai-type>
        <m-flag xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">true</m-flag>
        <sid xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">{sid}</sid>
        <ip-address xmlns="urn:opendaylight:params:xml:ns:yang:pcep:segment:routing">{hop}</ip-address>
@@ -804,11 +806,11 @@ def list_pcep_lsp(node_list, debug):
                                 for nexthop in route_obj:
                                     if 'ip-prefix' in nexthop.keys():
                                         ip_hoplist.append(nexthop['ip-prefix']['ip-prefix'])
-                                    if 'odl-pcep-segment-routing:sid-type' in nexthop.keys():
-                                        if nexthop['odl-pcep-segment-routing:sid-type'] == 'ipv4-node-id':
+                                    if 'odl-pcep-segment-routing:nai-type' in nexthop.keys():
+                                        if nexthop['odl-pcep-segment-routing:nai-type'] == 'ipv4-node-id':
                                             ip_hoplist.append(nexthop['odl-pcep-segment-routing:ip-address'])
                                             sid_list.append(nexthop['odl-pcep-segment-routing:sid'])
-                                        elif nexthop['odl-pcep-segment-routing:sid-type'] == 'ipv4-adjacency':
+                                        elif nexthop['odl-pcep-segment-routing:nai-type'] == 'ipv4-adjacency':
                                             ip_hoplist.append(nexthop['odl-pcep-segment-routing:remote-ip-address'])
                                             sid_list.append(nexthop['odl-pcep-segment-routing:sid'])
 

From 6ba29aa4e918f3b81099349f9781dcfc38b36ec8 Mon Sep 17 00:00:00 2001
From: "@abbedsedk" <abbed_sedkaoui@yahoo.fr>
Date: Fri, 5 Nov 2021 15:50:58 +0100
Subject: [PATCH 3/3] New version gives null reply -> HTTP 204 No content

---
 pathman_sr.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/pathman_sr.py b/pathman_sr.py
index a1dbfec..7bb273d 100644
--- a/pathman_sr.py
+++ b/pathman_sr.py
@@ -54,7 +54,8 @@
     20170202, Niklas - ver 5.9i - Refactored sid_list to sid_saves to avoid duplicate use
     20171013, Niklas - ver 5.9j - Updated odl version lis and checks
     20212210, Abbed Sedkaoui - 5.9k - Rename odl module Stateful07 -> Stateful
-    20212210, Abbed Sedkaoui - 5.9i - Rename SR-ERO suboject from sid-type to nai-type
+    20212210, Abbed Sedkaoui - 5.9l - Rename SR-ERO suboject from sid-type to nai-type
+    20213010, Abbed Sedkaoui - 5.9m - New version gives null reply. All credits to Niklas
     """
 __author__ = 'niklas'
 
@@ -1154,15 +1155,23 @@ def sort_paths(pathlist, metriclist, type):
 def postUrl(url, data):
     import requests
     response = requests.post(url, data=data, auth=(odl_user, odl_password), headers={'Content-Type': 'application/json'})
-    # print response.text
+    print response.text
+    # New version gives null reply
+    if response.status_code in [200, 204]:
+        return {'output': {}}
     return response.json()
 
 def postXml(url, data):
     """ post our lsp creation commands """
     import requests
+    logging.info('POST Payload: {}'.format(data))
+    print "POST Payload", data
     response = requests.post(url, data=data, auth=(odl_user, odl_password), headers={'Content-Type': 'application/xml'})
-    # print response.text
-
+    print "POST Response: '{}'".format(response.text)
+    logging.info('POST Response: {}'.format(response.text))
+    # New version gives null reply
+    if response.status_code in [200, 204]:
+        return {'output': {}}
     return response.json()
 
 def getPathlist(dict_subcommand,debug):