# Copyright 2022-2023 ETSI TeraFlowSDN - TFS OSG (https://tfs.etsi.org/) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # 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 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 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()