def registerEndpointLocation_multifabric(desc): nc_id1a = "vethl-h35-2" nc_id1b = "vethl-h35-3" nc_id2a = "vethl-h36-4" nc_id2b = "vethl-h36-5" nc_id3a = "vethl-h37-2" nc_id3b = "vethl-h37-3" nc_id4a = "vethl-h35-8" nc_id4b = "vethl-h36-8" nc_id4c = "vethl-h37-8" nodeId1 = util.getOvsdbNodeIdByName("sw11") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw12") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId3 = util.getOvsdbNodeIdByName("sw13") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId4 = util.getOvsdbNodeIdByName("sw21") if nodeId4 == constants.ERROR_STR: return constants.ERROR_STR nodeId5 = util.getOvsdbNodeIdByName("sw2") if nodeId5 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_3EPG_multifabric.get_endpoint_location_data(nc_id1a, nc_id1b, nc_id2a, nc_id2b, nc_id3a, nc_id3b, nc_id4a, nc_id4b, nc_id4c,nodeId1, nodeId2, nodeId3, nodeId4, nodeId5): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_multifabric_mn(desc): nodeId1 = util.getOvsdbNodeIdByName("sw11") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw12") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId3 = util.getOvsdbNodeIdByName("sw13") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId4 = util.getOvsdbNodeIdByName("sw21") if nodeId4 == constants.ERROR_STR: return constants.ERROR_STR nodeId5 = util.getOvsdbNodeIdByName("sw2") if nodeId5 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_3EPG_multifabric_mn.get_endpoint_location_data(nodeId1, nodeId2, nodeId3, nodeId4, nodeId5): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_multifabric_mn(desc): nodeId1 = util.getOvsdbNodeIdByName("sw11") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw12") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId3 = util.getOvsdbNodeIdByName("sw13") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId4 = util.getOvsdbNodeIdByName("sw21") if nodeId4 == constants.ERROR_STR: return constants.ERROR_STR nodeId5 = util.getOvsdbNodeIdByName("sw2") if nodeId5 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_3EPG_multifabric_mn.get_endpoint_location_data( nodeId1, nodeId2, nodeId3, nodeId4, nodeId5): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_3epg_sfc_acl(desc): nc_id1a = "vethl-h35-2" nc_id1b = "vethl-h35-3" nc_id2a = "vethl-h36-4" nc_id2b = "vethl-h36-5" nc_id3a = "vethl-h37-2" nc_id3b = "vethl-h37-3" nodeId1 = util.getOvsdbNodeIdByName("sw1") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw6") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId3 = util.getOvsdbNodeIdByName("sw7") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_3EPG_demo.get_endpoint_location_data( nc_id1a, nc_id1b, nc_id2a, nc_id2b, nc_id3a, nc_id3b, nodeId1, nodeId2, nodeId3): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_sfc(desc): nc_id1 = "vethl-h35-2" nc_id2 = "vethl-h36-4" nodeId1 = util.getOvsdbNodeIdByName("sw1") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw6") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_2EPG_SFC.get_endpoint_location_data(nc_id1, nc_id2, nodeId1, nodeId2): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_acl(desc): nc_id1 = "sw1-eth1" nc_id2 = "sw2-eth3" nodeId1 = util.getOvsdbNodeIdByName("sw1") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw2") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR for inputData in inputsGBP.get_endpoint_location_data(nc_id1, nc_id2, nodeId1, nodeId2): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_sfc(desc): nc_id1 = "vethl-h35-2" nc_id2 = "vethl-h36-4" nodeId1 = util.getOvsdbNodeIdByName("sw1") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw6") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_2EPG_SFC.get_endpoint_location_data( nc_id1, nc_id2, nodeId1, nodeId2): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_acl(desc): nc_id1 = "sw1-eth1" nc_id2 = "sw2-eth3" nodeId1 = util.getOvsdbNodeIdByName("sw1") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw2") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR for inputData in inputsGBP.get_endpoint_location_data( nc_id1, nc_id2, nodeId1, nodeId2): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def epMigrationDemo(desc): # unregister h35-3 fabricId = "fabric:1" mac = "00:00:00:00:35:03" ip = "10.0.35.3" resp = util.runRequestGET(inputsFabric.get_epList_uri(), sys._getframe().f_code.co_name) if resp == constants.ERROR_STR: print "ERROR: getOvsdbNodeIdByName() failed" return constants.ERROR_STR eplist = list() lswId = '' lport = '' endpointResp = json.loads(resp) if endpointResp.has_key("endpoints"): endpoints = endpointResp["endpoints"] if endpoints.has_key("endpoint"): for endpoint in endpoints["endpoint"]: if endpoint["ip-address"] == ip: eplist.append(endpoint["endpoint-uuid"]) logicLocation = endpoint["logic-location"] lswId = logicLocation["node-id"] lport = logicLocation["tp-id"] break result = util.runRequestPOST( inputsFabric.get_unregister_endpoint_uri(), json.dumps( inputsFabric.get_unregister_endpoint_data("fabric:1", eplist)), sys._getframe().f_code.co_name) # register h35-4 fabricId = "fabric:1" mac = "00:00:00:00:35:04" ip = "10.0.35.4" gw = "10.0.35.1" port = "vethl-h35-4" nodeid = util.getOvsdbNodeIdByName("sw6") nodeRef = BRIDGE_REF_P % (nodeid) tpRef = TP_REF_P % (nodeid, port) if nodeid == constants.ERROR_STR: return constants.ERROR_STR result = util.runRequestPOST( inputsFabric.get_register_endpoint_uri(), json.dumps( inputsFabric.get_register_endpoint_data(fabricId, mac, ip, gw, lswId, lport, nodeRef, tpRef)), sys._getframe().f_code.co_name) return desc
def registerEndpointLocation_multifabric(desc): nc_id1a = "vethl-h35-2" nc_id1b = "vethl-h35-3" nc_id2a = "vethl-h36-4" nc_id2b = "vethl-h36-5" nc_id3a = "vethl-h37-2" nc_id3b = "vethl-h37-3" nc_id4a = "vethl-h35-8" nc_id4b = "vethl-h36-8" nc_id4c = "vethl-h37-8" nodeId1 = util.getOvsdbNodeIdByName("sw11") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw12") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId3 = util.getOvsdbNodeIdByName("sw13") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId4 = util.getOvsdbNodeIdByName("sw21") if nodeId4 == constants.ERROR_STR: return constants.ERROR_STR nodeId5 = util.getOvsdbNodeIdByName("sw2") if nodeId5 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_3EPG_multifabric.get_endpoint_location_data( nc_id1a, nc_id1b, nc_id2a, nc_id2b, nc_id3a, nc_id3b, nc_id4a, nc_id4b, nc_id4c, nodeId1, nodeId2, nodeId3, nodeId4, nodeId5): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def registerEndpointLocation_3epg_sfc_acl(desc): nc_id1a = "vethl-h35-2" nc_id1b = "vethl-h35-3" nc_id2a = "vethl-h36-4" nc_id2b = "vethl-h36-5" nc_id3a = "vethl-h37-2" nc_id3b = "vethl-h37-3" nodeId1 = util.getOvsdbNodeIdByName("sw1") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId2 = util.getOvsdbNodeIdByName("sw6") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR nodeId3 = util.getOvsdbNodeIdByName("sw7") if nodeId1 == constants.ERROR_STR: return constants.ERROR_STR for inputData in tenant_3EPG_demo.get_endpoint_location_data(nc_id1a, nc_id1b, nc_id2a, nc_id2b, nc_id3a, nc_id3b, nodeId1, nodeId2, nodeId3): result = util.runRequestPOST(inputsGBP.get_endpoint_location_uri(), json.dumps(inputData), sys._getframe().f_code.co_name) return result
def epMigrationDemo(desc): # unregister h35-3 fabricId = "fabric:1" mac = "00:00:00:00:35:03" ip = "10.0.35.3" resp = util.runRequestGET(inputsFabric.get_epList_uri(), sys._getframe().f_code.co_name) if resp == constants.ERROR_STR: print "ERROR: getOvsdbNodeIdByName() failed" return constants.ERROR_STR eplist = list() lswId = '' lport = '' endpointResp=json.loads(resp) if endpointResp.has_key("endpoints"): endpoints = endpointResp["endpoints"] if endpoints.has_key("endpoint"): for endpoint in endpoints["endpoint"]: if endpoint["ip-address"] == ip: eplist.append(endpoint["endpoint-uuid"]) logicLocation = endpoint["logic-location"] lswId = logicLocation["node-id"] lport = logicLocation["tp-id"] break result = util.runRequestPOST(inputsFabric.get_unregister_endpoint_uri(), json.dumps(inputsFabric.get_unregister_endpoint_data("fabric:1", eplist)), sys._getframe().f_code.co_name) # register h35-4 fabricId = "fabric:1" mac = "00:00:00:00:35:04" ip = "10.0.35.4" gw = "10.0.35.1" port = "vethl-h35-4" nodeid = util.getOvsdbNodeIdByName("sw6") nodeRef = BRIDGE_REF_P % (nodeid) tpRef = TP_REF_P % (nodeid, port) if nodeid == constants.ERROR_STR: return constants.ERROR_STR result = util.runRequestPOST(inputsFabric.get_register_endpoint_uri(), json.dumps(inputsFabric.get_register_endpoint_data(fabricId, mac, ip, gw, lswId, lport, nodeRef, tpRef)), sys._getframe().f_code.co_name) return desc