diff --git a/src/device/tests/test_gnmi_nokia_srlinux-get-ifs.py b/src/device/tests/test_gnmi_nokia_srlinux-get-ifs.py index b9e1fda4266be023b527631cd42688112bbbf8e2..bda53bdd05d741c69ce69dc76565b155e5522e04 100644 --- a/src/device/tests/test_gnmi_nokia_srlinux-get-ifs.py +++ b/src/device/tests/test_gnmi_nokia_srlinux-get-ifs.py @@ -11,17 +11,138 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +# import logging, os, time os.environ['DEVICE_EMULATED_ONLY'] = 'YES' -# pylint: disable=wrong-import-position + #pylint: disable=wrong-import-position from device.service.drivers.gnmi_nokia_srlinux.GnmiNokiaSrLinuxDriver import GnmiNokiaSrLinuxDriver from device.service.driver_api._Driver import RESOURCE_INTERFACES , RESOURCE_NETWORK_INSTANCES,RESOURCE_TUNNEL_INTERFACE,RESOURCE_ROUTING_POLICY,RESOURCE_ENDPOINTS +#from test_gnmi_nokia_srlinux import interface,routing_policy,network_instance_default,vlan_interface,network_instance_vrf,tunnel_interface logging.basicConfig(level=logging.DEBUG) LOGGER = logging.getLogger(__name__) LOGGER.setLevel(logging.DEBUG) +# +#def test_gnmi_nokia_srlinux(): +# driver_settings_leaf1 = { +# 'protocol': 'gnmi', +# 'username': 'admin', +# 'password': 'NokiaSrl1!', +# 'use_tls': True, +# } +# dev1_driver = GnmiNokiaSrLinuxDriver('172.20.20.102', 57400, **driver_settings_leaf1) +# dev1_driver.Connect() +# resources_to_get_leaf1 = [RESOURCE_INTERFACES,RESOURCE_NETWORK_INSTANCES,RESOURCE_TUNNEL_INTERFACE,RESOURCE_ROUTING_POLICY] +# #resources_to_get_leaf1 = [RESOURCE_NETWORK_INSTANCES] +# LOGGER.info('resources_to_get = {:s}'.format(str(resources_to_get_leaf1))) +# results_getconfig_leaf1 = dev1_driver.GetConfig(resources_to_get_leaf1) +# LOGGER.info('results_getconfig = {:s}'.format(str(results_getconfig_leaf1))) +# time.sleep(1) +# dev1_driver.Disconnect() + +#time computing: +import logging +import time + +# Assuming GnmiNokiaSrLinuxDriver and other required functions are imported correctly +# Replace LOGGER with logging to maintain consistency +# +#logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') +# +#def test_gnmi_nokia_srlinux(): +# driver_settings_leaf1 = { +# 'protocol': 'gnmi', +# 'username': 'admin', +# 'password': 'NokiaSrl1!', +# 'use_tls': True, +# } +# driver_settings_leaf2 = { +# 'protocol': 'gnmi', +# 'username': 'admin', +# 'password': 'NokiaSrl1!', +# 'use_tls': True, +# } +# driver_settings_spine = { +# 'protocol': 'gnmi', +# 'username': 'admin', +# 'password': 'NokiaSrl1!', +# 'use_tls': True, +# } +# +# dev1_driver = GnmiNokiaSrLinuxDriver('172.20.20.102', 57400, **driver_settings_leaf1) +# dev2_driver = GnmiNokiaSrLinuxDriver('172.20.20.103', 57400, **driver_settings_leaf2) +# spine_driver = GnmiNokiaSrLinuxDriver('172.20.20.101', 57400, **driver_settings_spine) +# +# dev1_driver.Connect() +# dev2_driver.Connect() +# spine_driver.Connect() +# +# # Resources to get for all devices +# resources_to_get = [RESOURCE_INTERFACES, RESOURCE_NETWORK_INSTANCES, RESOURCE_TUNNEL_INTERFACE, RESOURCE_ROUTING_POLICY] +# +# # Initialize lists to store elapsed times for each device +# elapsed_times_leaf1 = [] +# elapsed_times_leaf2 = [] +# elapsed_times_spine = [] +# +# for i in range(10): # Run the test 10 times +# t0_iteration = time.time() +# +# # Measure time for GetConfig on Leaf 1 +# t0_leaf1 = time.time() +# results_getconfig_leaf1 = dev1_driver.GetConfig(resources_to_get) +# logging.info('Results of GetConfig on Leaf 1 in iteration %d: %s', i, results_getconfig_leaf1) +# time.sleep(1) +# t1_leaf1 = time.time() +# elapsed_time_leaf1 = t1_leaf1 - t0_leaf1 +# elapsed_times_leaf1.append(elapsed_time_leaf1) +# logging.info("Elapsed time for GetConfig on Leaf 1 in iteration %d: %.2f seconds", i, elapsed_time_leaf1) +# +# # Measure time for GetConfig on Leaf 2 +# t0_leaf2 = time.time() +# results_getconfig_leaf2 = dev2_driver.GetConfig(resources_to_get) +# logging.info('Results of GetConfig on Leaf 2 in iteration %d: %s', i, results_getconfig_leaf2) +# time.sleep(1) +# t1_leaf2 = time.time() +# elapsed_time_leaf2 = t1_leaf2 - t0_leaf2 +# elapsed_times_leaf2.append(elapsed_time_leaf2) +# logging.info("Elapsed time for GetConfig on Leaf 2 in iteration %d: %.2f seconds", i, elapsed_time_leaf2) +# +# # Measure time for GetConfig on Spine +# t0_spine = time.time() +# results_getconfig_spine = spine_driver.GetConfig(resources_to_get) +# logging.info('Results of GetConfig on Spine in iteration %d: %s', i, results_getconfig_spine) +# time.sleep(1) +# t1_spine = time.time() +# elapsed_time_spine = t1_spine - t0_spine +# elapsed_times_spine.append(elapsed_time_spine) +# logging.info("Elapsed time for GetConfig on Spine in iteration %d: %.2f seconds", i, elapsed_time_spine) +# +# # Measure the end time for the iteration +# t1_iteration = time.time() +# elapsed_time_iteration = t1_iteration - t0_iteration +# logging.info("Total elapsed time for iteration %d: %.2f seconds", i, elapsed_time_iteration) +# +# # Log the elapsed times for each device after all iterations +# logging.info("Elapsed times for Leaf 1: %s", elapsed_times_leaf1) +# logging.info("Elapsed times for Leaf 2: %s", elapsed_times_leaf2) +# logging.info("Elapsed times for Spine: %s", elapsed_times_spine) +# +# # Disconnect from devices +# dev1_driver.Disconnect() +# dev2_driver.Disconnect() +# spine_driver.Disconnect() +# +# return elapsed_times_leaf1, elapsed_times_leaf2, elapsed_times_spine + +import logging +import time + +# Assuming GnmiNokiaSrLinuxDriver and other required functions are imported correctly +# Replace LOGGER with logging to maintain consistency + +logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') def test_gnmi_nokia_srlinux(): driver_settings_leaf1 = { @@ -30,12 +151,95 @@ def test_gnmi_nokia_srlinux(): 'password': 'NokiaSrl1!', 'use_tls': True, } + driver_settings_leaf2 = { + 'protocol': 'gnmi', + 'username': 'admin', + 'password': 'NokiaSrl1!', + 'use_tls': True, + } + driver_settings_spine = { + 'protocol': 'gnmi', + 'username': 'admin', + 'password': 'NokiaSrl1!', + 'use_tls': True, + } + dev1_driver = GnmiNokiaSrLinuxDriver('172.20.20.102', 57400, **driver_settings_leaf1) + dev2_driver = GnmiNokiaSrLinuxDriver('172.20.20.103', 57400, **driver_settings_leaf2) + spine_driver = GnmiNokiaSrLinuxDriver('172.20.20.101', 57400, **driver_settings_spine) + dev1_driver.Connect() - #resources_to_get_leaf1 = [RESOURCE_INTERFACES,RESOURCE_NETWORK_INSTANCES,RESOURCE_TUNNEL_INTERFACE,RESOURCE_ROUTING_POLICY] - resources_to_get_leaf1 = [RESOURCE_NETWORK_INSTANCES] - LOGGER.info('resources_to_get = {:s}'.format(str(resources_to_get_leaf1))) - results_getconfig_leaf1 = dev1_driver.GetConfig(resources_to_get_leaf1) - LOGGER.info('results_getconfig = {:s}'.format(str(results_getconfig_leaf1))) - time.sleep(1) + dev2_driver.Connect() + spine_driver.Connect() + + # Resources to get for all devices + resources = [RESOURCE_INTERFACES, RESOURCE_NETWORK_INSTANCES, RESOURCE_TUNNEL_INTERFACE, RESOURCE_ROUTING_POLICY] + + # Initialize dictionaries to store timing information for each resource and device + timing_info_leaf1 = {resource: [] for resource in resources} + timing_info_leaf2 = {resource: [] for resource in resources} + timing_info_spine = {resource: [] for resource in resources} + + for resource in resources: + logging.info("Checking resource: %s", resource) + + for i in range(1000): # Run the test 10 times + t0_iteration = time.time() + + # Measure time for GetConfig on Leaf 1 + t0_leaf1 = time.time() + results_getconfig_leaf1 = dev1_driver.GetConfig([resource]) + t1_leaf1 = time.time() + elapsed_time_leaf1 = t1_leaf1 - t0_leaf1 + timing_info_leaf1[resource].append(elapsed_time_leaf1) + + # Measure time for GetConfig on Leaf 2 + t0_leaf2 = time.time() + results_getconfig_leaf2 = dev2_driver.GetConfig([resource]) + t1_leaf2 = time.time() + elapsed_time_leaf2 = t1_leaf2 - t0_leaf2 + timing_info_leaf2[resource].append(elapsed_time_leaf2) + + # Measure time for GetConfig on Spine + t0_spine = time.time() + results_getconfig_spine = spine_driver.GetConfig([resource]) + t1_spine = time.time() + elapsed_time_spine = t1_spine - t0_spine + timing_info_spine[resource].append(elapsed_time_spine) + + # Measure the end time for the iteration + t1_iteration = time.time() + elapsed_time_iteration = t1_iteration - t0_iteration + logging.info("Total elapsed time for resource %s in iteration %d: %.2f seconds", resource, i, elapsed_time_iteration) + + # Log the timing information for each resource and device at the end + for resource in resources: + logging.info("Timing information for resource %s on Leaf 1: %s", resource, timing_info_leaf1[resource]) + logging.info("Timing information for resource %s on Leaf 2: %s", resource, timing_info_leaf2[resource]) + logging.info("Timing information for resource %s on Spine: %s", resource, timing_info_spine[resource]) + + import csv + +# Assume timing_info_leaf1, timing_info_leaf2, and timing_info_spine are dictionaries containing your timing data + + with open('timing_results.csv', 'w', newline='') as csvfile: + fieldnames = ['Resource', 'Leaf1_Times', 'Leaf2_Times', 'Spine_Times'] + writer = csv.DictWriter(csvfile, fieldnames=fieldnames) + + writer.writeheader() + for resource in resources: + writer.writerow({ + 'Resource': resource, + 'Leaf1_Times': timing_info_leaf1[resource], + 'Leaf2_Times': timing_info_leaf2[resource], + 'Spine_Times': timing_info_spine[resource] + }) + + + + # Disconnect from devices dev1_driver.Disconnect() + dev2_driver.Disconnect() + spine_driver.Disconnect() + + diff --git a/src/device/tests/test_gnmi_nokia_srlinux.py b/src/device/tests/test_gnmi_nokia_srlinux.py index e919de2c532bb66a0a58fca0f2f8b4551ff677bf..c4366737ad09127641dcbb2fd1f1ca7b604e8a47 100644 --- a/src/device/tests/test_gnmi_nokia_srlinux.py +++ b/src/device/tests/test_gnmi_nokia_srlinux.py @@ -12,8 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import logging, os, sys, time +import logging, os, sys, time,csv from typing import Dict, Tuple +import logging +import numpy as np +import matplotlib.pyplot as plt os.environ['DEVICE_EMULATED_ONLY'] = 'YES' from device.service.drivers.gnmi_nokia_srlinux.GnmiNokiaSrLinuxDriver import GnmiNokiaSrLinuxDriver # pylint: disable=wrong-import-position from device.service.driver_api._Driver import ( @@ -157,114 +160,98 @@ def network_instance_default_spine(if_interface1_spine,if_interface2_spine,if_in return str_path, str_data -def test_gnmi_nokia_srlinux(): - #try: - driver_settings_leaf1 = { - 'protocol': 'gnmi', - 'username': 'admin', - 'password': 'NokiaSrl1!', - 'use_tls': True, - } - dev1_driver = GnmiNokiaSrLinuxDriver('172.20.20.102', 57400, **driver_settings_leaf1) - dev1_driver.Connect() - # resources_to_get_leaf1 = [RESOURCE_INTERFACES] - # LOGGER.info('resources_to_get = {:s}'.format(str(resources_to_get_leaf1))) - # results_getconfig_leaf1 = dev1_driver.GetConfig(resources_to_get_leaf1) - # LOGGER.info('results_getconfig = {:s}'.format(str(results_getconfig_leaf1))) - # except Exception as e: - # - # logging.exception("Exception occurred", exc_info=True) - resources_to_set_leaf1 = [ - ####LEAF1##### - interface('ethernet-1/49',True,0,True,'192.168.11.1','30'), - routing_policy('all','accept'), - network_instance_default('default','ethernet-1/49.0','system0.0',True,'ipv4-unicast',101,'all','eBGP-underlay','all',201,True,'evpn',False,'ipv4-unicast','all','iBGP-overlay','all',100,100,1,True,'10.0.0.2','iBGP-overlay','10.0.0.1','192.168.11.2','eBGP-underlay','10.0.0.1'), - interface('system0',True,0,True,'10.0.0.1','32'), - vlan_interface('ethernet-1/1',True,0,'bridged',True,'untagged'), - network_instance_vrf('vrf-1','mac-vrf',True,'ethernet-1/1.0','vxlan1.1',1,True,'vxlan1.1',111,1,'target:100:111','target:100:111'), - tunnel_interface('vxlan1', 1, 'bridged', 1), - ] - results_setconfig_leaf1 = dev1_driver.SetConfig(resources_to_set_leaf1) - LOGGER.info('Leaf 1 results_setconfig = {:s}'.format(str(results_setconfig_leaf1))) - time.sleep(1) - dev1_driver.Disconnect() -######LEAF2############################## - driver_settings_leaf2 = { +#######setting computing: +import logging +import time + +# Configure logging +logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') + +def test_gnmi_nokia_srlinux(): + driver_settings_leaf1 = { 'protocol': 'gnmi', 'username': 'admin', 'password': 'NokiaSrl1!', 'use_tls': True, - } - dev2_driver = GnmiNokiaSrLinuxDriver('172.20.20.103', 57400, **driver_settings_leaf2) - dev2_driver.Connect() - - resources_to_set_leaf2 = [ - interface('ethernet-1/49',True,0,True,'192.168.12.1','30'), - routing_policy('all','accept'), - network_instance_default('default','ethernet-1/49.0','system0.0',True,'ipv4-unicast',102,'all','eBGP-underlay','all',201,True,'evpn',False,'ipv4-unicast','all','iBGP-overlay','all',100,100,1,True,'10.0.0.1','iBGP-overlay','10.0.0.2','192.168.12.2','eBGP-underlay','10.0.0.2'), - interface('system0',True,0,True,'10.0.0.2','32'), - vlan_interface('ethernet-1/1',True,0,'bridged',True,'untagged'), - network_instance_vrf('vrf-1','mac-vrf',True,'ethernet-1/1.0','vxlan1.1',1,True,'vxlan1.1',111,1,'target:100:111','target:100:111'), - tunnel_interface('vxlan1', 1, 'bridged', 1), - - ] - results_setconfig_leaf2 = dev2_driver.SetConfig(resources_to_set_leaf2) - LOGGER.info('Leaf 2 results_setconfig = {:s}'.format(str(results_setconfig_leaf2))) - - time.sleep(1) - dev2_driver.Disconnect() -############SPINE############################################ - driver_settings_spine = { - 'protocol': 'gnmi', - 'username': 'admin', - 'password': 'NokiaSrl1!', - 'use_tls': True, - } - spine_driver = GnmiNokiaSrLinuxDriver('172.20.20.101', 57400, **driver_settings_spine) - spine_driver.Connect() - - resources_to_set_spine = [ - interface('ethernet-1/1',True,0,True,'192.168.11.2','30'), - interface('ethernet-1/2',True,0,True,'192.168.12.2','30'), - network_instance_default_spine('ethernet-1/1.0','ethernet-1/2.0','system0.0','default',True,'ipv4-unicast',201,'all','eBGP-underlay','all','192.168.11.1',101,'eBGP-underlay','192.168.12.1',102,'eBGP-underlay','10.0.1.1'), - interface('system0',True,0,True,'10.0.1.1',32), - routing_policy('all','accept'), - - ] - results_setconfig_spine = spine_driver.SetConfig(resources_to_set_spine) - LOGGER.info('Spine results_setconfig = {:s}'.format(str(results_setconfig_spine))) - - - time.sleep(1) - spine_driver.Disconnect() - + } + driver_settings_leaf2 = { + 'protocol': 'gnmi', + 'username': 'admin', + 'password': 'NokiaSrl1!', + 'use_tls': True, + } + driver_settings_spine = { + 'protocol': 'gnmi', + 'username': 'admin', + 'password': 'NokiaSrl1!', + 'use_tls': True, + } -# #results_setconfig = dev1_driver.SetConfig(resources_to_set) - #LOGGER.info('results_setconfig = {:s}'.format(str(results_setconfig))) - - #resources_to_get = [RESOURCE_INTERFACES] - #LOGGER.info('resources_to_get = {:s}'.format(str(resources_to_get))) - #results_getconfig = dev1_driver.GetConfig(resources_to_get) - #LOGGER.info('results_getconfig = {:s}'.format(str(results_getconfig))) + devices = { + 'leaf1': GnmiNokiaSrLinuxDriver('172.20.20.102', 57400, **driver_settings_leaf1), + 'leaf2': GnmiNokiaSrLinuxDriver('172.20.20.103', 57400, **driver_settings_leaf2), + 'spine': GnmiNokiaSrLinuxDriver('172.20.20.101', 57400, **driver_settings_spine) + } - #resources_to_delete = [ - # interface('ethernet-1/49', 0, '192.168.11.1', 30, True), - #routing_policy('all',True) - #] + for device in devices.values(): + device.Connect() - #LOGGER.info('resources_to_delete = {:s}'.format(str(resources_to_delete))) - #results_deleteconfig = dev1_driver.DeleteConfig(resources_to_delete) - #LOGGER.info('results_deleteconfig = {:s}'.format(str(results_deleteconfig))) + resources = { + 'leaf1': [ + ('routing_policy', routing_policy('', '')), + ('interface', interface('ethernet-1/49', True, 0, True, '192.168.11.1', '30')), + ('network_instance', network_instance_default('default', 'ethernet-1/49.0', 'system0.0', True, 'ipv4-unicast', 101, 'all', 'eBGP-underlay', 'all', 201, True, 'evpn', False, 'ipv4-unicast', 'all', 'iBGP-overlay', 'all', 100, 100, 1, True, '10.0.0.2', 'iBGP-overlay', '10.0.0.1', '192.168.11.2', 'eBGP-underlay', '10.0.0.1')), + ('interface', interface('system0', True, 0, True, '10.0.0.1', '32')), + ('vlan_interface', vlan_interface('ethernet-1/1', True, 0, 'bridged', True, 'untagged')), + ('network_instance_vrf', network_instance_vrf('vrf-1', 'mac-vrf', True, 'ethernet-1/1.0', 'vxlan1.1', 1, True, 'vxlan1.1', 111, 1, 'target:100:111', 'target:100:111')), + ('tunnel_interface', tunnel_interface('vxlan1', 1, 'bridged', 1)), + ], + 'leaf2': [ + ('routing_policy', routing_policy('', '')), + ('interface', interface('ethernet-1/49', True, 0, True, '192.168.12.1', '30')), + ('network_instance', network_instance_default('default', 'ethernet-1/49.0', 'system0.0', True, 'ipv4-unicast', 102, 'all', 'eBGP-underlay', 'all', 201, True, 'evpn', False, 'ipv4-unicast', 'all', 'iBGP-overlay', 'all', 100, 100, 1, True, '10.0.0.1', 'iBGP-overlay', '10.0.0.2', '192.168.12.2', 'eBGP-underlay', '10.0.0.2')), + ('interface', interface('system0', True, 0, True, '10.0.0.2', '32')), + ('vlan_interface', vlan_interface('ethernet-1/1', True, 0, 'bridged', True, 'untagged')), + ('network_instance_vrf', network_instance_vrf('vrf-1', 'mac-vrf', True, 'ethernet-1/1.0', 'vxlan1.1', 1, True, 'vxlan1.1', 111, 1, 'target:100:111', 'target:100:111')), + ('tunnel_interface', tunnel_interface('vxlan1', 1, 'bridged', 1)), + ], + 'spine': [ + ('routing_policy', routing_policy('', '')), + ('interface', interface('ethernet-1/1', True, 0, True, '192.168.11.2', '30')), + ('interface', interface('ethernet-1/2', True, 0, True, '192.168.12.2', '30')), + ('network_instance', network_instance_default_spine('ethernet-1/1.0', 'ethernet-1/2.0', 'system0.0', 'default', True, 'ipv4-unicast', 201, 'all', 'eBGP-underlay', 'all', '192.168.11.1', 101, 'eBGP-underlay', '192.168.12.1', 102, 'eBGP-underlay', '10.0.1.1')), + ('interface', interface('system0', True, 0, True, '10.0.1.1', 32)), + ] + } - #resources_to_get = [RESOURCE_INTERFACES] - #LOGGER.info('resources_to_get = {:s}'.format(str(resources_to_get))) - #results_getconfig = dev1_driver.GetConfig(resources_to_get) - #LOGGER.info('results_getconfig = {:s}'.format(str(results_getconfig))) + # Initialize dictionary to store timing information + timing_info = {device: {resource[0]: [] for resource in resources[device]} for device in resources} - #time.sleep(1) - #dev1_driver.Disconnect() - return 0 + # Perform the configuration 10 times and measure time for each configuration set + for device_name, device_resources in resources.items(): + for i in range(1000): + for resource_name, resource in device_resources: + start_time = time.time() + devices[device_name].DeleteConfig([resource]) + end_time = time.time() + elapsed_time = end_time - start_time + timing_info[device_name][resource_name].append(elapsed_time) + logging.info(f"Iteration {i+1} for {resource_name} on {device_name}: {elapsed_time:.2f} seconds") + # Log final timing information + for device_name, resource_timings in timing_info.items(): + for resource_name, times in resource_timings.items(): + logging.info(f"Timing information for {resource_name} on {device_name}: {times}") + with open('timing_information_delete.csv', mode='w', newline='') as file: + writer = csv.writer(file) + writer.writerow(['Device', 'Resource', 'Time(seconds)']) + + for device_name, resource_timings in timing_info.items(): + for resource_name, times in resource_timings.items(): + for time_taken in times: + writer.writerow([device_name, resource_name, f"{time_taken:.6f}"]) + for device in devices.values(): + device.Disconnect() \ No newline at end of file diff --git a/src/device/tests/test_gnmi_srlinux-delete.py b/src/device/tests/test_gnmi_srlinux-delete.py new file mode 100644 index 0000000000000000000000000000000000000000..509dec685583aaf7cd1e9dd1f4489c03c5a73386 --- /dev/null +++ b/src/device/tests/test_gnmi_srlinux-delete.py @@ -0,0 +1,37 @@ +import logging, os, time +os.environ['DEVICE_EMULATED_ONLY'] = 'YES' + +# pylint: disable=wrong-import-position +from device.service.drivers.gnmi_nokia_srlinux.GnmiNokiaSrLinuxDriver import GnmiNokiaSrLinuxDriver +from device.service.driver_api._Driver import RESOURCE_INTERFACES , RESOURCE_NETWORK_INSTANCES,RESOURCE_TUNNEL_INTERFACE,RESOURCE_ROUTING_POLICY,RESOURCE_ENDPOINTS +from test_gnmi_nokia_srlinux import interface,routing_policy,network_instance_default,vlan_interface,network_instance_vrf,tunnel_interface + +logging.basicConfig(level=logging.DEBUG) +LOGGER = logging.getLogger(__name__) +LOGGER.setLevel(logging.DEBUG) + +def test_gnmi_nokia_srlinux(): + driver_settings_leaf1 = { + 'protocol': 'gnmi', + 'username': 'admin', + 'password': 'NokiaSrl1!', + 'use_tls': True, + } + dev1_driver = GnmiNokiaSrLinuxDriver('172.20.20.102', 57400, **driver_settings_leaf1) + dev1_driver.Connect() + resources_to_delete = [ + ####LEAF1##### + interface('ethernet-1/49',True,0,True,'192.168.11.1','30'), + routing_policy('all','accept'), + network_instance_default('default','ethernet-1/49.0','system0.0',True,'ipv4-unicast',101,'all','eBGP-underlay','all',201,True,'evpn',False,'ipv4-unicast','all','iBGP-overlay','all',100,100,1,True,'10.0.0.2','iBGP-overlay','10.0.0.1','192.168.11.2','eBGP-underlay','10.0.0.1'), + interface('system0',True,0,True,'10.0.0.1','32'), + vlan_interface('ethernet-1/1',True,0,'bridged',True,'untagged'), + network_instance_vrf('vrf-1','mac-vrf',True,'ethernet-1/1.0','vxlan1.1',1,True,'vxlan1.1',111,1,'target:100:111','target:100:111'), + tunnel_interface('vxlan1', 1, 'bridged', 1), + ] + + LOGGER.info('resources_to_delete = {:s}'.format(str(resources_to_delete))) + results_deleteconfig_leaf1 = dev1_driver.DeleteConfig(resources_to_delete) + LOGGER.info('results_delete = {:s}'.format(str(results_deleteconfig_leaf1))) + time.sleep(1) + dev1_driver.Disconnect() \ No newline at end of file