egress_acl_uuid = sg_rec['egress_acl_uuid'] ingress_acl_uuid = sg_rec['ingress_acl_uuid'] url_dict_resp = introspect.get_acl_details(egress_acl_uuid) if len(url_dict_resp['acl_list']) == 1: egress_acl_rec = url_dict_resp['acl_list'][0] oper['egress_acl'] = egress_acl_rec else: error = True url_dict_resp = introspect.get_acl_details(ingress_acl_uuid) if len(url_dict_resp['acl_list']) == 1: ingress_acl_rec = url_dict_resp['acl_list'][0] oper['ingress_acl'] = ingress_acl_rec else: error = True pstr = "Agent Verified security group %s %s" % (sg_uuid, 'with errors' if error else '') self.logger.info(pstr) return oper def parse_args(args): parser = ArgumentParser(description=debugVertexSG.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--display_name', help='Display name') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vSG= debugVertexSG(**args) vP = vertexPrint(vSG) vP.convert_json()
def parse_args(args): parser = ArgumentParser(description='Debug utility for Flow', add_help=True) #parser.add_argument('--source_ip', help='Source IP of the flow', required=True) #parser.add_argument('--dest_ip', help='Destination IP of the flow', required=True) #parser.add_argument('--source_vn', help='VN of the source IP') #parser.add_argument('--dest_vn', help='VN of the destination IP') #parser.add_argument('--protocol', help='L3 Protocol of the flow') #parser.add_argument('--source_port', help='Source Port of the flow') #parser.add_argument('--dest_port', help='Destination Port of the flow') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vFlow = baseFlowVertex(source_ip='30.30.30.3', vrouters=[{ 'hostname': 'a3s19', 'ip_address': '10.84.17.5', 'sandesh_http_port': 8085 }], dest_ip='30.30.30.3', source_vrf='default-domain:admin:testvn:testvn', dest_vrf='default-domain:admin:testvn:testvn', **args) #config_ip='10.84.17.5', #config_port='8082') vP = vertexPrint(vFlow) vP.convert_json()
control = {} control['oper'] = {} self._add_control_to_context(vertex, control) def _get_agent_oper_db(self, introspect, vertex): error = False vn_uuid = vertex['uuid'] oper = {} vn_info = introspect.get_vn_details(vn_uuid) if len(vn_info['vn_list'] or []) == 1: vn_rec = vn_info['vn_list'][0] oper[vertex['vertex_type']] = vn_rec else: error = True pstr = "Got more vn records, supposed to have one for uuid %s" % (vn_uuid) self.logger.error(pstr) pstr = "Agent Verified virtual network %s %s" % (vn_uuid, 'with errors' if error else '') self.logger.info(pstr) return oper def parse_args(args): parser = ArgumentParser(description=debugVertexVN.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--display_name', help='Display name') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vVN= debugVertexVN(**args) vP = vertexPrint(vVN) vP.convert_json()
def _get_control_oper_db(self, introspect, vertex): control = {} vmi_uuid = vertex['uuid'] # bgp_neighbors bgp_neighbor_list = introspect.get_bgpneighbor_list() if not bgp_neighbor_list: self.logger.info("bgp_neighbor_list doesnt exist") else: for bgp_neighbor in bgp_neighbor_list['neighbors']: if bgp_neighbor['peer'] == vmi_uuid: self.logger.info("Control: Interface %s has bgp neighbor" % (vmi_uuid)) control['bgp-neighbors'] = bgp_neighbor return control def parse_args(args): parser = ArgumentParser(description=debugVertexVMI.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vVMI = debugVertexVMI(**args) vP = vertexPrint(vVMI) vP.convert_json() vP.convert_to_file_structure(console_print=True)
(intf_rec['uuid'], intf_rec['name'], intf_rec['dhcp_service']) error = True self.logger.error(pstr) else: self.logger.info("Agent: Interface %s dhcp is enabled" % (intf_rec['name'])) # Is dns enabled if intf_rec['dns_service'] != 'Enable': pstr = "Agent Error %s, %s, dns is %s, but not enabled" % \ (intf_rec['uuid'], intf_rec['name'], intf_rec['dns_service']) error = True self.logger.error(pstr) else: self.logger.info("Agent: Interface %s dns is enabled" % (intf_rec['name'])) pstr = "Agent Verified interface %s %s" % (intf_rec['name'], 'with errors' if error else '') self.logger.info(pstr) oper['interface'] = intf_details return oper def parse_args(args): parser = ArgumentParser(description=debugVertexVMI.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vVMI= debugVertexVMI(**args) vP = vertexPrint(vVMI) vP.convert_json() vP.convert_to_file_structure(console_print=True)
egress_acl_rec = url_dict_resp['acl_list'][0] oper['egress_acl'] = egress_acl_rec else: error = True url_dict_resp = introspect.get_acl_details(ingress_acl_uuid) if len(url_dict_resp['acl_list']) == 1: ingress_acl_rec = url_dict_resp['acl_list'][0] oper['ingress_acl'] = ingress_acl_rec else: error = True pstr = "Agent Verified security group %s %s" % (sg_uuid, 'with errors' if error else '') self.logger.info(pstr) return oper def parse_args(args): parser = ArgumentParser(description=debugVertexSG.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--display_name', help='Display name') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vSG = debugVertexSG(**args) vP = vertexPrint(vSG) vP.convert_json()
if nh: knh.extend(introspect.get_knh(rt['nh_id'])) return {'route': route, 'kroute': kroute, 'knh': knh} def _get_control_oper_db(self, introspect, vertex): (exists, route) = introspect.is_route_exists(self.ri[vertex['uuid']], self.prefix) if not exists: self.logger.warn( 'Route for %s doesnt exist in VRF %s of control %s' % (self.prefix, self.ri[vertex['uuid']], introspect._ip)) return {'route': route} def parse_args(args): parser = ArgumentParser(description=debugVertexRoute.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--ri_fqname', help='FQName of the Routing Instance') parser.add_argument('--vn_fqname', help='FQName of the Virtual Network') parser.add_argument('--prefix', help='Route prefix to verify') parser.add_argument('--vrouters', help='List of vrouters to verify') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vRoute = debugVertexRoute(**args) vP = vertexPrint(vRoute) vP.convert_json()
vn_uuid = vertex['uuid'] oper = {} vn_info = introspect.get_vn_details(vn_uuid) if len(vn_info['vn_list'] or []) == 1: vn_rec = vn_info['vn_list'][0] oper[vertex['vertex_type']] = vn_rec else: error = True pstr = "Got more vn records, supposed to have one for uuid %s" % ( vn_uuid) self.logger.error(pstr) pstr = "Agent Verified virtual network %s %s" % (vn_uuid, 'with errors' if error else '') self.logger.info(pstr) return oper def parse_args(args): parser = ArgumentParser(description=debugVertexVN.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--display_name', help='Display name') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vVN = debugVertexVN(**args) vP = vertexPrint(vVN) vP.convert_json()
error = True self.logger.error(pstr) print pstr return oper # Is interface active if intf_rec['active'] != 'Active': pstr = "Agent Error %s, %s is not Active" % (intf_rec['uuid'], intf_rec['name']) error = True self.logger.error(pstr) print pstr else: pstr = "Agent: Interface %s is active" % (intf_rec['name']) self.logger.debug(pstr) print pstr oper['interface'] = intf_details return oper def parse_args(args): parser = ArgumentParser(description=debugVertexSample.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vSample= debugVertexSample(**args) # Vertex Print object for json/file structure display of processed objects vP = vertexPrint(vSample) vP.convert_json() vP.convert_to_file_structure()
if not exists: self.logger.warn('Route for %s doesnt exist in VRF %s of kernel %s'%( self.prefix, self.ri[vertex['uuid']], introspect._ip)) for rt in kroute: nh = rt.get('nh_id') if nh: knh.extend(introspect.get_knh(rt['nh_id'])) return {'route': route, 'kroute': kroute, 'knh': knh} def _get_control_oper_db(self, introspect, vertex): (exists, route) = introspect.is_route_exists(self.ri[vertex['uuid']], self.prefix) if not exists: self.logger.warn('Route for %s doesnt exist in VRF %s of control %s'%( self.prefix, self.ri[vertex['uuid']], introspect._ip)) return {'route': route} def parse_args(args): parser = ArgumentParser(description=debugVertexRoute.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--ri_fqname', help='FQName of the Routing Instance') parser.add_argument('--vn_fqname', help='FQName of the Virtual Network') parser.add_argument('--prefix', help='Route prefix to verify') parser.add_argument('--vrouters', help='List of vrouters to verify') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vRoute = debugVertexRoute(**args) vP = vertexPrint(vRoute) vP.convert_json()
refs = {p['object_type']:p['object_fq_name'] for p in self.service_chain[uuid]['obj_refs']} sis = self.si_vertex[uuid] = [self.context.get_vertex_of_fqname(fqname, 'service-instance') for fqname in refs['service_instance']] vertex['path'] = [] for si in sis: si_path = dict() si_path['vrouters'] = si['vrouters'] si_path['natted_ips'] = si['natted_ips'] si_path['left_vrf'] = si['left_vrf'] si_path['right_vrf'] = si['right_vrf'] si_path['si_name'] = si['fq_name'] vertex['path'].append(si_path) def parse_args(args): parser = ArgumentParser(description=debugVertexSC.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--left_vn_fq_name', help='FQName of the Left VN', required=True) parser.add_argument('--right_vn_fq_name', help='FQName of the Right VN', required=True) parser.add_argument('--left_ip', help='Left CIDR specified in policy') parser.add_argument('--right_ip', help='Right CIDR specified in policy') parser.add_argument('--protocol', help='L3 Protocol of the flow') parser.add_argument('--left_port', help='Source Port of the flow') parser.add_argument('--right_port', help='Destination Port of the flow') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vSC= debugVertexSC(**args) vP = vertexPrint(vSC) vP.convert_json()
break if not match: pstr = "fip address %s is not found in the interface rec %s" % \ (self.floating_ip_address, intf_rec['name']) self.logger.error(pstr) print pstr return oper # Get routing entry (check, route) = inspect_h.is_prefix_exists(fip_vrf, prefix=fip_address) oper['route'] = route if check is True: nh_list = route['path_list'] if nh_list: print "Agent got nh for %s" % (fip_address) else: print "Agent Error doesn't have route for %s" % (fip_address) return oper def parse_args(args): parser = ArgumentParser(description=debugVertexFIP.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--floating_ip_address', help='Floating ip address to debug') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vFIP= debugVertexFIP(**args) vP = vertexPrint(vFIP) vP.convert_json() vP.convert_to_file_structure()
continue vmi = vmi['virtual-machine-interface'] if vmi['virtual_machine_interface_properties']['service_interface_type'] == 'right': for iip_dict in vmi['instance_ip_back_refs']: iip_id = iip_dict['uuid'] iip, discard = self.config.get_object('instance-ip', where='uuid='+iip_id) iip = iip[0]['instance-ip'] if iip.get('instance_ip_secondary', False): continue vertex['natted_ips'].append(iip['instance_ip_address']) vertex['right_vrf'] = right_vn + ':' + right_vn.split(':')[-1] vertex['left_vrf'] = schema.get_vrfs_of_vn(left_vn, sc_uuid=self.sc_name, si_name=vertex['fq_name'])[0] elif vertex['st_mode'] == 'in-network': vertex['right_vrf'] = schema.get_vrfs_of_vn(right_vn, sc_uuid=self.sc_name, si_name=vertex['fq_name'])[0] vertex['left_vrf'] = schema.get_vrfs_of_vn(left_vn, sc_uuid=self.sc_name, si_name=vertex['fq_name'])[0] vertex['vrouters'] = self.get_vrouters(vertex) def parse_args(args): parser = ArgumentParser(description=debugVertexSI.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--display_name', help='Display name') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vSI= debugVertexSI(**args) vP = vertexPrint(vSI) vP.convert_json()
source_ip=path['sip'], dest_ip=path['dip'], source_vrf=path['source_vrf'], dest_vrf=path['dest_vrf'], source_nip=path.get('snip'), dest_nip=path.get('dnip'), source_vn=self.source_vn, dest_vn=self.dest_vn, source_port=self.source_port, dest_port=self.dest_port, protocol=self.protocol ) def parse_args(args): parser = ArgumentParser(description=debugVertexFlow.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--source_ip', help='Source IP of the flow', required=True) parser.add_argument('--dest_ip', help='Destination IP of the flow', default='') parser.add_argument('--source_vn', help='VN of the source IP', required=True) parser.add_argument('--dest_vn', help='VN of the destination IP', default='') parser.add_argument('--protocol', help='L3 Protocol of the flow', default='') parser.add_argument('--source_port', help='Source Port of the flow', default='') parser.add_argument('--dest_port', help='Destination Port of the flow', default='') parser.add_argument('--source_ip_type', help='source ip type', default='') parser.add_argument('--dest_ip_type', help='dest ip type', default='') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vFlow = debugVertexFlow(**args) vertexPrint(vFlow).convert_json()
for key in DictDiffer(current, initial).changed()} initial = current return dropstats def parse_args(args): parser = ArgumentParser(description='Debug utility for Flow', add_help=True) #parser.add_argument('--source_ip', help='Source IP of the flow', required=True) #parser.add_argument('--dest_ip', help='Destination IP of the flow', required=True) #parser.add_argument('--source_vn', help='VN of the source IP') #parser.add_argument('--dest_vn', help='VN of the destination IP') #parser.add_argument('--protocol', help='L3 Protocol of the flow') #parser.add_argument('--source_port', help='Source Port of the flow') #parser.add_argument('--dest_port', help='Destination Port of the flow') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vFlow = baseFlowVertex(source_ip='30.30.30.3', vrouters=[{'hostname':'a3s19', 'ip_address': '10.84.17.5', 'sandesh_http_port': 8085}], dest_ip='30.30.30.3', source_vrf='default-domain:admin:testvn:testvn', dest_vrf='default-domain:admin:testvn:testvn', **args) #config_ip='10.84.17.5', #config_port='8082') vP = vertexPrint(vFlow) vP.convert_json()
else: pstr = "IP address %s is NOT found in the interface rec %s" % \ (instance_ip_address, intf_rec['name']) self.logger.error(pstr) return oper # Get routing entry (check, route) = inspect_h.is_prefix_exists(intf_rec['vrf_name'], prefix=instance_ip_address) oper['route'] = route if check is True: nh_list = route['path_list'] if nh_list: self.logger.info("Agent got nh for %s" % (instance_ip_address)) else: self.logger.error("Agent Error doesn't have route for %s" % (instance_ip_address)) return oper def parse_args(args): parser = ArgumentParser(description=debugVertexIP.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--instance_ip_address', help='Instance ip address to debug') parser.add_argument('--virtual_network', help='Virtual network uuid') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vIIP= debugVertexIP(**args) vP = vertexPrint(vIIP) vP.convert_json()
vertex_type = 'routing-instance' def __init__(self, **kwargs): self.dependant_vertexes = [debugvn.debugVertexVN] super(debugVertexRI, self).__init__(**kwargs) def process_self(self, vertex): pass def get_schema(self, **kwargs): #VN UUID, VMI UUID schema_dict = { "virtual-network": { "uuid": 'routing_instances' }, "virtual-machine-interface": { "uuid": 'routing_instance_refs' } } return schema_dict def parse_args(args): parser = ArgumentParser(description=debugVertexRI.__doc__, add_help=True, formatter_class=RawTextHelpFormatter) parser.add_argument('--display_name', help='Display name') return parser.parse_args(args) if __name__ == '__main__': args = parse_args(sys.argv[1:]) vRI= debugVertexRI(**args) vP = vertexPrint(vRI) vP.convert_json()