def test_execute_prpd_api(): """Test execute prpd api""" grpc_lib_path = '/volume/regressions/grpc_lib/latest' sys.path.append(grpc_lib_path) from jnpr.toby.hldcl import device # pylint: disable=import-error from jnpr.toby.services.prpd.prpd import execute_prpd_api # pylint: disable=import-error dev = MagicMock() dev.current_node.current_controller.default_grpc_channel = 1 dev.current_node.current_controller.channels = { 'grpc': [MagicMock(), MagicMock()] } dev.current_node.current_controller.channels['grpc'][ 1].send_api.return_value = "test" kwargs = {'command': 'rib_route_add',\ 'next_hop_interface':'et-1/0/0:0.0',\ 'dest_prefix':["23.1.1.2", "23.1.1.3", "23.1.1.4", "23.1.1.5",],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':['10.1.1.2', '10.1.1.3', '10.1.1.4', '10.1.1.5'],\ 'preferences0':6,\ 'preferences1':101,\ 'colors0':30,\ 'colors1':31,\ 'tags0':16,\ 'tags1':17,\ 'weight':'WEIGHT_PRIMARY',\ 'no_advertise': True,\ 'bandwidth': 100} value = execute_prpd_api(dev, channel_ID=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" kwargs = {} dest_prefix = ['20.1.1.1'] kwargs = {'command': 'rib_route_add', 'next_hop_interface':'ge-0/0/0.0',\ 'dest_prefix':dest_prefix, 'table':'inet.0', 'prefix_len':32, 'next_hop':'10.1.1.2'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" dest_prefix = [ '20.1.1.1', ] kwargs = {'command': 'rib_route_modify',\ 'next_hop_interface':'ge-0/0/0.0',\ 'dest_prefix':dest_prefix,\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':'10.1.1.2',\ 'label':[100, 200, 300],\ 'opcode':['PUSH', 'PUSH', 'POP'],\ 'preferences0':12,\ 'preferences1':13,\ 'colors0':14,\ 'colors1':15,\ 'tags0':16,\ 'tags1':17,\ 'bulk_count':23,\ 'weight': 100} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" kwargs = {'command': 'rib_route_get',\ 'dest_prefix':"0.0.0.0",\ 'table':'inet.0',\ 'prefix_len':10,\ 'count':23,\ 'tags0':5,\ 'tags1':10,\ 'route_match_type':"EXACT_OR_LONGER"} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" dest_next_hop = [] for i in range(0, 5): intv4 = int(netaddr.IPAddress("15.1.1.2")) intv4 = intv4 + i nh4 = str(netaddr.IPAddress(intv4)) dest_next_hop.append(nh4) dest_prefix_1 = [] kwargs = {'command': 'rib_route_update',\ 'next_hop_interface':'ge-0/0/0.0',\ 'dest_prefix':["20.1.1.1", "20.1.1.2"],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':dest_next_hop,\ 'label':[100, 200, 300],\ 'opcode':['PUSH', 'PUSH', 'POP'],\ 'preferences0':12,\ 'preferences1':13,\ 'colors0':14,\ 'colors1':15,\ 'tags0':16,\ 'tags1':17,\ 'bulk_count':23,\ 'weight': 'WEIGHT_BACKUP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" dest_next_hop = [] for i in range(0, 5): intv4 = int(netaddr.IPAddress("15.1.1.2")) intv4 = intv4 + i nh4 = str(netaddr.IPAddress(intv4)) dest_next_hop.append(nh4) dest_prefix_1 = [] for i in range(0, 25): intv4 = int(netaddr.IPAddress("20.1.1.1")) intv4 = intv4 + i nh4 = str(netaddr.IPAddress(intv4)) dest_prefix_1.append(nh4) execute_prpd_api(dev, channel_id=None, command="rib_route_add", next_hop_interface="et-0/0/1:2.0", dest_prefix=dest_prefix_1,\ table="inet.0", prefix_len=32, cookie=44444444444425, next_hop=dest_next_hop, preferences0=6,\ preferences1=55, colors0=10, colors1=15, tags0=44, tags1=99, bulk_count=23) if value[0] == "test": pass else: assert False, "Route add failed" kwargs = {'command':'rib_route_add',\ 'next_hop_interface':'ge-0/0/0.0',\ 'dest_prefix':'10.40.0.1',\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':'10.10.0.1',\ 'label':8000,\ 'opcode':'push',\ 'weight':'WEIGHT_NONE'} execute_prpd_api(dev, channel_id=None, **kwargs) kwargs1 = {'command':'rib_route_add',\ 'dest_prefix':'8000',\ 'table':'mpls.0',\ 'prefix_len':52,\ 'next_hop':'10.40.0.1',\ 'opcode':'pop'} execute_prpd_api(dev, channel_id=None, **kwargs1) for i in range(0, 10): intv4 = int(netaddr.IPAddress("20.1.1.1")) intv4 = intv4 + i nh4 = str(netaddr.IPAddress(intv4)) dest_prefix_1.append(nh4) labels = [8001, 8002, 8003, 8004, 8005, 8006, 8007, 8008, 8009, 8010] kwargs = {'command':'rib_route_add',\ #'next_hop_interface':'ge-0/0/0.0',\ 'dest_prefix':'10.40.0.1',\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':dest_prefix_1,\ 'label':labels,\ 'opcode':'push'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" kwargs = {'command': 'rib_route_add',\ 'next_hop_interface':'et-1/0/0:0.0',\ 'destination_prefix':["23.1.1.2", "23.1.1.3", "23.1.1.4", "23.1.1.5",],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':[['10.1.1.2', '10.1.1.3', '10.1.1.4', '10.1.1.5'], ['11.1.1.2', '11.1.1.3', '11.1.1.4', '11.1.1.5'], ['12.1.1.2', '12.1.1.3', '12.1.1.4', '12.1.1.5'], ['13.1.1.2', '13.1.1.3', '13.1.1.4', '13.1.1.5']],\ 'preferences0':6,\ 'preferences1':101,\ 'colors0':30,\ 'colors1':31,\ 'tags0':16,\ 'tags1':17,\ 'no_advertise': True,\ 'weight':[['WEIGHT_PRIMARY'],[1,2,'WEIGHT_BACKUP'],['WEIGHT_NONE']],\ 'bandwidth': [[100,60,80,230],[10,12],[23,22,45]] } value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" kwargs = {'command': 'rib_route_add',\ 'next_hop_interface':'et-1/0/0:0.0',\ 'destination_prefix':["23.1.1.2", "23.1.1.3", "23.1.1.4", "23.1.1.5",],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':[['10.1.1.2', '10.1.1.3', '10.1.1.4', '10.1.1.5'], ['11.1.1.2', '11.1.1.3', '11.1.1.4', '11.1.1.5'], ['12.1.1.2', '12.1.1.3', '12.1.1.4', '12.1.1.5'], ['13.1.1.2', '13.1.1.3', '13.1.1.4', '13.1.1.5']],\ 'preferences0':6,\ 'preferences1':101,\ 'colors0':30,\ 'colors1':31,\ 'tags0':16,\ 'tags1':17,\ 'no_advertise': True,\ 'weight':[['WEIGHT_PRIMARY'],[1,2,'WEIGHT_BACKUP'],['WEIGHT_NONE']],\ 'bandwidth': [[100,60,80,230],[10,12],[23,22,45]],\ 'ecmp':True } value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" labels = [[8001, 8002, 8003], [8001, 8002, 8003], [8001, 8002, 8003]] opcode = ['PUSH', 'PUSH', 'PUSH'] kwargs = {'command': 'rib_route_add',\ 'next_hop_interface':'et-1/0/0:0.0',\ 'destination_prefix':["23.1.1.2", "23.1.1.3", "23.1.1.4", "23.1.1.5",],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':[['10.1.1.2', '10.1.1.3', '10.1.1.4', '10.1.1.5'], ['11.1.1.2', '11.1.1.3', '11.1.1.4', '11.1.1.5'], ['12.1.1.2', '12.1.1.3', '12.1.1.4', '12.1.1.5'], ['13.1.1.2', '13.1.1.3', '13.1.1.4', '13.1.1.5']],\ 'preferences0':6,\ 'preferences1':101,\ 'colors0':30,\ 'colors1':31,\ 'tags0':16,\ 'tags1':17,\ 'no_advertise': True,\ 'label':labels,\ 'opcode':opcode,\ 'weight':[['WEIGHT_PRIMARY'],[1,2,'WEIGHT_BACKUP'],['WEIGHT_NONE']],\ 'stack_labels':True,\ 'ecmp':True #'bandwidth': [[100,60,80,230],[10,12],[23,22,45]] } value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" labels = [[8001, 8002, 8003], [8001, 8002, 8003], [8001, 8002, 8003]] opcode = ['PUSH', 'PUSH', 'PUSH'] kwargs = {'command': 'rib_route_add',\ 'next_hop_interface':'et-1/0/0:0.0',\ 'destination_prefix':["23.1.1.2", "23.1.1.3", "23.1.1.4", "23.1.1.5",],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':[['10.1.1.2', '10.1.1.3', '10.1.1.4', '10.1.1.5'], ['11.1.1.2', '11.1.1.3', '11.1.1.4', '11.1.1.5'], ['12.1.1.2', '12.1.1.3', '12.1.1.4', '12.1.1.5'], ['13.1.1.2', '13.1.1.3', '13.1.1.4', '13.1.1.5']],\ 'preferences0':6,\ 'preferences1':101,\ 'colors0':30,\ 'colors1':31,\ 'tags0':16,\ 'tags1':17,\ 'no_advertise': True,\ 'label':labels,\ 'opcode':opcode,\ 'weight':[['WEIGHT_PRIMARY'],[1,2,'WEIGHT_BACKUP'],['WEIGHT_NONE']],\ 'stack_labels':True #'bandwidth': [[100,60,80,230],[10,12],[23,22,45]] } value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed" labels = [8001, 8002, 8003] opcode = ['PUSH', 'PUSH', 'PUSH'] kwargs = {'command': 'rib_route_add',\ 'next_hop_interface':'et-1/0/0:0.0',\ 'destination_prefix':["23.1.1.2", "23.1.1.3", "23.1.1.4", "23.1.1.5",],\ 'table':'inet.0',\ 'prefix_len':32,\ 'next_hop':[['10.1.1.2', '10.1.1.3', '10.1.1.4', '10.1.1.5'], ['11.1.1.2', '11.1.1.3', '11.1.1.4', '11.1.1.5'], ['12.1.1.2', '12.1.1.3', '12.1.1.4', '12.1.1.5'], ['13.1.1.2', '13.1.1.3', '13.1.1.4', '13.1.1.5']],\ 'preferences0':6,\ 'preferences1':101,\ 'colors0':30,\ 'colors1':31,\ 'tags0':16,\ 'tags1':17,\ 'no_advertise': True,\ 'label':labels,\ 'opcode':opcode,\ 'weight':[['WEIGHT_PRIMARY'],[1,2,'WEIGHT_BACKUP'],['WEIGHT_NONE']] #'bandwidth': [[100,60,80,230],[10,12],[23,22,45]] } value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "Route add failed"
def test_execute_prpd_api(): """Test execute prpd api""" grpc_lib_path = '/volume/regressions/grpc_lib/latest' sys.path.append(grpc_lib_path) from jnpr.toby.hldcl import device # pylint: disable=import-error from jnpr.toby.services.prpd.prpd import execute_prpd_api # pylint: disable=import-error dev = MagicMock() dev.current_node.current_controller.default_grpc_channel = 1 dev.current_node.current_controller.channels = { 'grpc': [MagicMock(), MagicMock()] } dev.current_node.current_controller.channels['grpc'][ 1].send_api.return_value = "test" value = execute_prpd_api(dev, channel_id=None, command="interface_initialize") if value == "test": pass else: assert False, "interface_initialize failed" value = execute_prpd_api(dev, channel_id=None, command="interface_get", interface='ge-0/0/0.0') if value == "test": pass else: assert False, "interface_get failed" value = execute_prpd_api(dev, channel_id=None, command="interface_get", index=333) if value == "test": pass else: assert False, "interface_get failed" value = execute_prpd_api(dev, channel_id=None, command="interface_notification_register") if value == "test": pass else: assert False, "interface_notification_register failed" value = execute_prpd_api(dev, channel_id=None, command="interface_notification_unregister") if value == "test": pass else: assert False, "interface_notification_unregister failed" value = execute_prpd_api(dev, channel_id=None, command="interface_notification_refresh") if value == "test": pass else: assert False, "interface_notification_refresh failed"
def test_execute_prpd_api(): """Test execute prpd api""" grpc_lib_path = '/volume/regressions/grpc_lib/latest' sys.path.append(grpc_lib_path) from jnpr.toby.hldcl import device # pylint: disable=import-error from jnpr.toby.services.prpd.prpd import execute_prpd_api # pylint: disable=import-error dev = MagicMock() dev.current_node.current_controller.default_grpc_channel = 1 dev.current_node.current_controller.channels = { 'grpc': [MagicMock(), MagicMock()] } dev.current_node.current_controller.channels['grpc'][ 1].send_api.return_value = "test" kwargs = {'command': 'bgp_init'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Bgp Init failed" dest_prefix = ['20.1.1.1'] kwargs = {'command': 'bgp_route_add', 'dest_prefix':dest_prefix,\ 'table':'inet.0', 'prefix_len':32, 'next_hop':'10.1.1.2',\ 'communities':'100:1','cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Add failed" dest_prefix = ['2001:120:1:1::1'] kwargs = {'command': 'bgp_route_update', 'dest_prefix':dest_prefix,\ 'table':'inet6.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix_1 = [] for i in range(0, 25): intv4 = int(netaddr.IPAddress("20.1.1.1")) intv4 = intv4 + i nh4 = str(netaddr.IPAddress(intv4)) dest_prefix_1.append(nh4) kwargs = {'command': 'bgp_route_modify', 'dest_prefix':dest_prefix_1,\ 'table':'inet6.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Modify failed" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'rd_type': 0, 'as_number': 100, 'assigned_number': 1 } kwargs = {'command': 'bgp_route_update', 'dest_prefix':dest_prefix,\ 'table':'bgp.l3vpn-inet6.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'api_user':'******'} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'rd_type': 0, 'as_number': 100, 'assigned_number': 1 } kwargs = {'command': 'bgp_route_update', 'dest_prefix':dest_prefix,\ 'table':'bgp.l3vpn-inet6.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = { 'dest_prefix': '120.1.1.1', 'rd_type': 1, 'as_number': 100, 'assigned_number': 1, 'ipaddress': '1.1.1.1' } kwargs = {'command': 'bgp_route_update', 'dest_prefix':dest_prefix,\ 'table':'bgp.l3vpn.0', 'prefix_len':92, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'vpn_label':16} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = { 'dest_prefix': '120.1.1.1', 'rd_type': 2, 'as_number': 100, 'assigned_number': 1, 'table': 'bgp.l3vpn.0' } kwargs = {'command': 'bgp_route_remove', 'dest_prefix':dest_prefix,\ 'table':'bgp.l3vpn.0', 'prefix_len':192, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'vpn_label':16,'orlonger':1} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Remove failed" dest_prefix = { 'dest_prefix': '120.1.1.1', 'rd_type': 2, 'as_number': 100, 'assigned_number': 1, 'table': 'bgp.l3vpn.0' } kwargs = {'command': 'bgp_route_remove', 'dest_prefix':dest_prefix,\ 'table':'bgp.l3vpn.0', 'prefix_len':192, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'vpn_label':16,'orlonger':1,'api_user':'******'} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Remove failed" dest_prefix = { 'dest_prefix': '120.1.1.1', 'sr_color': 2, 'sr_distinguisher': 100 } route_data = {'segment_lists':[{'weight':1,\ 'segment_entries':[{'label':100,'traffic_class':1,'bottom_of_stack':False,'ttl':1},{'label':101,'traffic_class':1,'bottom_of_stack':1,'ttl':1}]}],\ 'sr_preference':100,'binding_sid':{'label':100,'traffic_class':1,'bottom_of_stack':1,'ttl':1}} kwargs = {'command': 'bgp_route_add', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'bgp.inetsrte.0', 'prefix_len':192, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'sr_color': 2, 'sr_distinguisher': 100 } route_data = {'segment_lists':[{'weight':1,\ 'segment_entries':[{'label':100,'traffic_class':1,'bottom_of_stack':False,'ttl':1},{'label':101,'traffic_class':1,'bottom_of_stack':1,'ttl':1}]}],\ 'sr_preference':100,'binding_sid':{'label':100,'traffic_class':1,'bottom_of_stack':1,'ttl':1}} kwargs = {'command': 'bgp_route_add', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'bgp.inet6srte.0', 'prefix_len':192, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'sr_color': 2, 'sr_distinguisher': 100 } route_data = {'segment_lists':[{'weight':1,\ 'segment_entries':[{'label':100,'traffic_class':1,'bottom_of_stack':False,'ttl':1},{'label':101,'traffic_class':1,'bottom_of_stack':1,'ttl':1}]}],\ 'sr_preference':100,'binding_sid':{'label':100,'traffic_class':1,'bottom_of_stack':1,'ttl':1}} kwargs = {'command': 'bgp_route_get', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'bgp.inet6srte.0', 'prefix_len':192, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'orlonger':1,'active_only':True,'route_count':10,'reply_address_format':0,'reply_table_format':0,'api_user':'******'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == 'test': pass else: assert False, "Bgp Route get failed" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'sr_color': 2, 'sr_distinguisher': 100 } route_data = {'segment_lists':[{'weight':1,\ 'segment_entries':[{'label':100,'traffic_class':1,'bottom_of_stack':False,'ttl':1},{'label':101,'traffic_class':1,'bottom_of_stack':1,'ttl':1}]}],\ 'sr_preference':100,'binding_sid':{'label':100,'traffic_class':1,'bottom_of_stack':1,'ttl':1}} kwargs = {'command': 'bgp_route_get', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'bgp.inet6srte.0', 'prefix_len':192, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'orlonger':1,'active_only':True,'route_count':10,'reply_address_format':0,'reply_table_format':0} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == 'test': pass else: assert False, "Bgp Route get failed" kwargs = { 'command': 'bgp_monitor_register', 'route_count': 10, 'reply_address_format': 0, 'reply_table_format': 0 } value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == 'test': pass else: assert False, "Bgp Monitor Register failed" kwargs = {'command': 'bgp_monitor_unregister'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == 'test': pass else: assert False, "Bgp Monitor Unregister failed" dest_prefix = ['2001:120:1:1::1'] kwargs = {'command': 'bgp_route_update', 'dest_prefix':dest_prefix,\ 'table':'inet6.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3'],\ 'communities':['100:1','100:2'],'cluster_id':'1.1.1.1','originator_id':'1.1.1.1',\ 'route_preference':100,'local_preference':400,'med':100,'aspath':'100','route_type':1,\ 'path_cookie':10,'api_user':'******'} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = ['2001:120:1:1::1'] kwargs = { 'command': 'bgp_route_update', 'dest_prefix': dest_prefix, 'api_user': '******' } valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" dest_prefix = ['2001:120:1:1::1'] kwargs = { 'command': 'bgp_route_update', 'dest_prefix': dest_prefix, 'table': 'inet.0', 'api_user': '******' } valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route Update failed" """Flow spec""" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'dest_len': 32, 'src_prefix': '2001:12:1:1::1', 'src_len': 32, 'protocols': [10, 12], 'ports': [12, 12] } route_data = { 'discard': True, 'rate_limit': 1000, 'mark_dscp': 1, 'sample': True, 'redirect_to_vrf': "vrf1" } kwargs = {'command': 'bgp_route_add', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'inetflow.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3']} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route add failed" dest_prefix = { 'dest_prefix': '120.1.1.1', 'dest_len': 32, 'src_prefix': '12.1.1.1', 'src_len': 32, 'protocols': [10, 12], 'ports': [12, 12] } route_data = { 'discard': True, 'rate_limit': 1000, 'mark_dscp': 1, 'sample': True, 'redirect_to_vrf': "vrf1" } kwargs = {'command': 'bgp_route_modify', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'inetflow.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3']} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route modify failed" dest_prefix = { 'dest_prefix': '2001:120:1:1::1', 'dest_len': 32, 'src_prefix': '2001:12:1:1::1', 'src_len': 32, 'protocols': [10, 12], 'ports': [12, 12] } route_data = { 'discard': True, 'rate_limit': 1000, 'mark_dscp': 1, 'sample': True, 'redirect_to_vrf': "vrf1" } kwargs = {'command': 'bgp_route_get', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'inetflow.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3']} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == 'test': pass else: assert False, "Bgp Route get failed" dest_prefix = { 'dest_prefix': '12.1.1.1', 'dest_len': 32, 'src_prefix': '120.1.1.1', 'src_len': 32, 'protocols': [10, 12], 'ports': [12, 12] } route_data = { 'discard': True, 'rate_limit': 1000, 'mark_dscp': 1, 'sample': True, 'redirect_to_vrf': "vrf1" } kwargs = {'command': 'bgp_route_remove', 'dest_prefix':dest_prefix,'routedata':route_data,\ 'table':'inetflow.0', 'prefix_len':64, 'next_hop':['10.1.1.2','10.1.1.3']} valuelist = execute_prpd_api(dev, channel_id=None, **kwargs) for value in valuelist: if value == 'test': pass else: assert False, "Bgp Route remove failed"
def test_execute_prpd_api(): """Test execute prpd api""" grpc_lib_path = '/volume/regressions/grpc_lib/latest' sys.path.append(grpc_lib_path) from jnpr.toby.hldcl import device # pylint: disable=import-error from jnpr.toby.services.prpd.prpd import execute_prpd_api # pylint: disable=import-error dev = MagicMock() dev.current_node.current_controller.default_grpc_channel = 1 dev.current_node.current_controller.channels = {'grpc':[MagicMock(), MagicMock()]} dev.current_node.current_controller.channels['grpc'][1].send_api.return_value = "test" kwargs = {'command':"gribi_add",\ 'type_of_operation':"next_hop",\ 'table_name':"inet6.3",\ 'next_hop_id':10,\ 'labels':["50010"]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"next_hop_group",\ 'table_name':"inet6.3",\ 'next_hop_groupid':[110],\ 'color':111,\ 'next_hop_id':[10],\ 'weight':[70]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"route",\ 'table_name':"inetcolor.0",\ 'family':"inet",\ 'prefix':"10.255.2.121-111<c>",\ 'prefix_length':64,\ 'next_hop_groupid':110} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"route",\ 'table_name':"inet6color.0",\ 'family':"inet6",\ 'prefix':"::ffff:10.255.2.121-112<c6>",\ 'prefix_length':160,\ 'next_hop_groupid':110} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"route",\ 'table_name':"mpls.0",\ 'family':"mpls",\ 'prefix':"1110",\ 'prefix_length':52,\ 'next_hop_groupid':110} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"next_hop",\ 'next_hop_id':10,\ 'labels':["50011", "50009", "50003"]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"route",\ 'table_name':"inet.0",\ 'family':"inet",\ 'prefix':"111.111.111.0",\ 'prefix_length':24,\ 'next_hop_groupid':110} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"route",\ 'table_name':"inet6.0",\ 'family':"inet6",\ 'prefix':"::ffff:111.111.111.1",\ 'prefix_length':128,\ 'next_hop_groupid':110} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"next_hop",\ 'table_name':"inet6.3",\ 'next_hop_id':20,\ 'gateway_address':"2.1.1.2",\ 'interface_name':"xe-0/0/0:2.0"} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"next_hop_group",\ 'table_name':"inet6.3",\ 'next_hop_groupid':[110],\ 'color':111,\ 'next_hop_id':[10, 20],\ 'weight':[70, 30]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_add",\ 'type_of_operation':"next_hop_group",\ 'table_name':"inet6.3",\ 'next_hop_groupid':[210],\ 'color':111,\ 'next_hop_id':[10, 20],\ 'weight':[70, 30]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"route",\ 'table_name':"inetcolor.0",\ 'family':"inet",\ 'prefix':"10.255.2.121-111<c>",\ 'prefix_length':64,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"route",\ 'table_name':"inet6color.0",\ 'family':"inet6",\ 'prefix':"::ffff:10.255.2.121-112<c6>",\ 'prefix_length':160,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"route",\ 'table_name':"mpls.0",\ 'family':"mpls",\ 'prefix':"1110",\ 'prefix_length':52,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"route",\ 'table_name':"inet.0",\ 'family':"inet",\ 'prefix':"111.111.111.0",\ 'prefix_length':24,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"route",\ 'table_name':"inet6.0",\ 'family':"inet6",\ 'prefix':"::ffff:111.111.111.1",\ 'prefix_length':128,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_modify",\ 'type_of_operation':"next_hop",\ 'next_hop_id':10,\ 'labels':["50011", "50009", "50003"]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"next_hop",\ 'table_name':"inet6.3",\ 'next_hop_id':20,\ 'gateway_address':"2.1.1.2",\ 'interface_name':"xe-0/0/0:2.0"} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"next_hop_group",\ 'table_name':"inet6.3",\ 'next_hop_groupid':[110],\ 'next_hop_id':[10, 20],\ 'weight':[70, 30]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"next_hop_group",\ 'table_name':"inet6.3",\ 'next_hop_groupid':[210],\ 'color':111,\ 'next_hop_id':[10, 20],\ 'weight':[70, 30]} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"route",\ 'table_name':"inetcolor.0",\ 'family':"inet",\ 'prefix':"10.255.2.121-111<c>",\ 'prefix_length':64,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"route",\ 'table_name':"inet6color.0",\ 'family':"inet6",\ 'prefix':"::ffff:10.255.2.121-112<c6>",\ 'prefix_length':160,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"route",\ 'table_name':"mpls.0",\ 'family':"mpls",\ 'prefix':"1110",\ 'prefix_length':52,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"route",\ 'table_name':"inet.0",\ 'family':"inet",\ 'prefix':"111.111.111.0",\ 'prefix_length':24,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed" kwargs = {'command':"gribi_delete",\ 'type_of_operation':"route",\ 'table_name':"inet6.0",\ 'family':"inet6",\ 'prefix':"::ffff:111.111.111.1",\ 'prefix_length':128,\ 'next_hop_groupid':210} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Route add failed"
def test_execute_prpd_api(): """Test execute prpd api""" grpc_lib_path = '/volume/regressions/grpc_lib/latest' sys.path.append(grpc_lib_path) from jnpr.toby.hldcl import device # pylint: disable=import-error from jnpr.toby.services.prpd.prpd import execute_prpd_api # pylint: disable=import-error dev = MagicMock() dev.current_node.current_controller.default_grpc_channel = 1 dev.current_node.current_controller.channels = { 'grpc': [MagicMock(), MagicMock()] } dev.current_node.current_controller.channels['grpc'][ 1].send_api.return_value = "test" ##'BFD INIT' kwargs = {'command': 'bfd_initialize'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Bfd Init failed" ##'BFD SUBSCRIBE' kwargs = {'command': 'bfd_notification_subscribe'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "Bfd Subscribe Request failed" ##'BFD Session Add4 1 RM 1 LO 1INTF' kwargs = {} remote_address = ['2.1.1.2'] kwargs = {'command':'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'local_address':'2.1.1.1', \ 'interface_name':'ge-0/0/0.0', 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':10, 'minimum_tx_interval':2000, \ 'multiplier':3, 'minimum_rx_interval':2000, 'minimum_echo_tx_interval':2000, \ 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session Add6 1 RM 1 LO 1INTF' remote_address = ['2000:2:1:1::2'] kwargs = {'command':'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'local_address':'2000:2:1:1::1', \ 'interface_name':'ge-0/0/0.0', 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':10, 'minimum_tx_interval':2000, \ 'multiplier':3, 'minimum_rx_interval':2000, 'minimum_echo_tx_interval':2000, \ 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session Add 1 RM' kwargs = {'command':'bfd_session_add', 'remote_address':'2.1.2.2', 'session_id':0, 'cookie':10, \ 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session Add4 1 RM 1LC 1INTF' kwargs = {'command':'bfd_session_add', 'session_id':0, 'remote_address':'2.1.3.2', 'local_address':'2.1.3.1', \ 'interface_name':'ge-0/0/0.0', 'cookie':10, 'minimum_tx_interval':2000, \ 'multiplier':3, 'minimum_rx_interval':2000, 'minimum_echo_tx_interval':2000, 'session_type':'ECHO_LITE', \ 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session delete' kwargs = {'command': 'bfd_session_delete', 'session_id': 1} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session delete failed" ##'BFD Session delete bulk' session_id = [1, 2, 3, 4, 5] kwargs = {'command': 'bfd_session_delete', 'session_id': session_id} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session delete failed" #'BFD Session deleteall' kwargs = {'command': 'bfd_session_delete_all'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "bfd session delete all failed" ##'BFD Unsubscribe' kwargs = {'command': 'bfd_notification_unsubscribe'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value == "test": pass else: assert False, "bfd session unsubscribe failed" ##'BFD Session Add4 3 RM 3LC 3INTF' remote_address = ['2.1.1.2', '2.1.2.2', '2.1.3.2'] local_address = ['2.1.1.1', '2.1.2.1', '2.1.3.1'] interface_name = ['ge-0/0/0.0', 'ge-0/0/0.1', 'ge-0/0/0.2'] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'local_address':local_address, \ 'interface_name':interface_name, 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99999, 'minimum_tx_interval':1000, \ 'multiplier':6, 'minimum_rx_interval':1000, 'minimum_echo_tx_interval': 1000, \ 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session Add4 3 RM 1LC 1INTF' remote_address = ['2.1.1.2', '2.1.2.2', '2.1.3.2'] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'local_address':'2.1.1.1', \ 'interface_name':'ge-0/0/0.0', 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99, 'minimum_tx_interval':1000, \ 'multiplier':3, 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session Add6 3 RM 3LC 3INTF' remote_address = ['2000:2:1:1::2', '2000:2:1:2::2', '2000:2:1:3::2'] local_address = ['2000:2:1:1::1', '2000:2:1:2::1', '2000:2:1:3::1'] interface_name = ['ge-0/0/0.0', 'ge-0/0/0.1', 'ge-0/0/0.2'] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'local_address':local_address, \ 'interface_name':interface_name, 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99999, 'minimum_tx_interval':1000, \ 'multiplier':6, 'minimum_rx_interval':1000, 'minimum_echo_tx_interval': 1000, \ 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" ##'BFD Session Add4 16 RM' remote_address = [ '2.1.1.2', '2.1.2.2', '2.1.3.2', '2.1.4.2', '2.1.5.2', '2.1.6.2', '2.1.7.2', '2.1.8.2', '2.1.9.2', '2.1.10.2', '2.1.11.2', '2.1.12.2', '2.1.13.2', '2.1.14.2', '2.1.15.2', '2.1.16.2' ] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99999, 'minimum_tx_interval':1000, \ 'multiplier':6, 'minimum_rx_interval':1000, 'minimum_echo_tx_interval': 1000, \ 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" remote_address = [ '2.1.1.2', '2.1.2.2', '2.1.3.2', '2.1.4.2', '2.1.5.2' ] local_address = ['2.1.1.1', '2.1.2.1'] interface_name = ['ge-0/0/0.0', 'ge-0/0/0.1'] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99999, 'minimum_tx_interval':1000, \ 'multiplier':6, 'minimum_rx_interval':1000, 'minimum_echo_tx_interval': 1000, 'local_address':local_address, \ 'interface_name':interface_name, 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" remote_address = [ '2.1.1.2', '2.1.2.2', '2.1.3.2', '2.1.4.2', '2.1.5.2' ] local_address = ['2.1.1.1', '2.1.2.1', '2.1.3.1'] interface_name = ['ge-0/0/0.0', 'ge-0/0/0.1'] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99999, 'minimum_tx_interval':1000, \ 'multiplier':6, 'minimum_rx_interval':1000, 'minimum_echo_tx_interval': 1000, 'local_address':local_address, \ 'interface_name':interface_name, 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed" remote_address = ['2.1.1.2'] local_address = ['2.1.1.1', '2.1.2.1', '2.1.3.1'] interface_name = ['ge-0/0/0.0', 'ge-0/0/0.1'] kwargs = {'command': 'bfd_session_add', 'session_id':0, 'remote_address':remote_address, 'remote_distinguisher':10, 'local_distinguisher':0, 'cookie':99999, 'minimum_tx_interval':1000, \ 'multiplier':6, 'minimum_rx_interval':1000, 'minimum_echo_tx_interval': 1000, 'local_address':local_address, \ 'interface_name':interface_name, 'session_type':'ECHO_LITE', 'session_mode':'SINGLE_HOP'} value = execute_prpd_api(dev, channel_id=None, **kwargs) if value[0] == "test": pass else: assert False, "bfd session add failed"