###############################################################################
# Copyright (c) 2017 Koren Lev (Cisco Systems), Yaron Yogev (Cisco Systems) #
# and others #
# #
# All rights reserved. This program and the accompanying materials #
# are made available under the terms of the Apache License, Version 2.0 #
# which accompanies this distribution, and is available at #
# http://www.apache.org/licenses/LICENSE-2.0 #
###############################################################################
VNICS_FOLDER = {
"create_object": True,
"environment": "Mirantis-Liberty-Xiaocong",
"id": "bf0cb914-b316-486c-a4ce-f22deb453c52-vnics",
"id_path": "/Mirantis-Liberty-Xiaocong/Mirantis-Liberty-Xiaocong-regions/RegionOne/RegionOne-availability_zones/osdna-zone/node-5.cisco.com/node-5.cisco.com-instances/bf0cb914-b316-486c-a4ce-f22deb453c52/bf0cb914-b316-486c-a4ce-f22deb453c52-vnics",
"name": "vNICs",
"name_path": "/Mirantis-Liberty-Xiaocong/Regions/RegionOne/Availability Zones/osdna-zone/node-5.cisco.com/Instances/test/vNICs",
"object_name": "vNICs",
"parent_id": "bf0cb914-b316-486c-a4ce-f22deb453c52",
"parent_type": "instance",
"show_in_tree": True,
"text": "vNICs",
"type": "vnics_folder"
}
INSATNCE = {
"_id": "5806817e4a0a8a3fbe3bee8b",
"children_url": "/osdna_dev/discover.py?type=tree&id=bf0cb914-b316-486c-a4ce-f22deb453c52",
"environment": "Mirantis-Liberty-Xiaocong",
"host": "node-5.cisco.com",
"id": "bf0cb914-b316-486c-a4ce-f22deb453c52",
"id_path": "/Mirantis-Liberty-Xiaocong/Mirantis-Liberty-Xiaocong-regions/RegionOne/RegionOne-availability_zones/osdna-zone/node-5.cisco.com/node-5.cisco.com-instances/bf0cb914-b316-486c-a4ce-f22deb453c52",
"ip_address": "192.168.0.4",
"local_name": "instance-00000026",
"mac_address": "fa:16:3e:e8:7f:04",
"name": "test",
"name_path": "/Mirantis-Liberty-Xiaocong/Regions/RegionOne/Availability Zones/osdna-zone/node-5.cisco.com/Instances/test",
"network": [
"2e3b85f4-756c-49d9-b34c-f3db13212dbc"
],
"network_info": [
{
"devname": "tap1f72bd15-8a",
"id": "1f72bd15-8ab2-43cb-94d7-e823dd845255",
"profile": {
},
"vnic_type": "normal",
"type": "ovs",
"address": "fa:16:3e:e8:7f:04",
"qbg_params": None,
"network": {
"bridge": "br-int",
"label": "123456",
"subnets": [
{
"cidr": "172.16.13.0/24",
"version": 4,
"gateway": {
"version": 4,
"meta": {
},
"address": "172.16.13.1",
"type": "gateway"
},
"routes": [
],
"dns": [
],
"ips": [
{
"meta": {
},
"version": 4,
"type": "fixed",
"address": "172.16.13.4",
"floating_ips": [
]
}
],
"meta": {
"dhcp_server": "172.16.13.2"
}
}
],
"meta": {
"tenant_id": "75c0eb79ff4a42b0ae4973c8375ddf40",
"injected": False
},
"id": "2e3b85f4-756c-49d9-b34c-f3db13212dbc"
},
"active": True,
"meta": {
},
"details": {
"port_filter": True,
"ovs_hybrid_plug": True
},
"preserve_on_delete": False,
"qbh_params": None,
"ovs_interfaceid": "1f72bd15-8ab2-43cb-94d7-e823dd845255"
}
],
"object_name": "test",
"parent_id": "node-5.cisco.com-instances",
"parent_type": "instances_folder",
"project_id": "75c0eb79ff4a42b0ae4973c8375ddf40",
"projects": [
"OSDNA-project"
],
"show_in_tree": True,
"type": "instance",
"uuid": "bf0cb914-b316-486c-a4ce-f22deb453c52"
}
COMPUTE_HOST = {
"environment": "Mirantis-Liberty-Xiaocong",
"host": "node-5.cisco.com",
"host_type": [
"Compute"
],
"id": "node-5.cisco.com",
"id_path": "/Mirantis-Liberty-Xiaocong/Mirantis-Liberty-Xiaocong-regions/RegionOne/RegionOne-availability_zones/osdna-zone/node-5.cisco.com",
"ip_address": "192.168.0.4",
"name": "node-5.cisco.com",
"name_path": "/Mirantis-Liberty-Xiaocong/Regions/RegionOne/Availability Zones/osdna-zone/node-5.cisco.com",
"object_name": "node-5.cisco.com",
"os_id": "1",
"parent_id": "osdna-zone",
"parent_type": "availability_zone",
"services": {
"nova-compute": {
"active": True,
"available": True,
"updated_at": "2016-10-21T18:01:42.000000"
}
},
"show_in_tree": True,
"type": "host",
"zone": "osdna-zone"
}
NETWORK_HOST = {
"config": {
"interfaces": 4,
"log_agent_heartbeats": False,
"gateway_external_network_id": "",
"router_id": "",
"interface_driver": "neutron.agent.linux.interface.OVSInterfaceDriver",
"ex_gw_ports": 2,
"routers": 2,
"handle_internal_only_routers": True,
"floating_ips": 1,
"external_network_bridge": "",
"use_namespaces": True,
"agent_mode": "legacy"
},
"environment": "Mirantis-Liberty-Xiaocong",
"host": "node-6.cisco.com",
"host_type": [
"Controller",
"Network"
],
"id": "node-6.cisco.com",
"id_path": "/Mirantis-Liberty-Xiaocong/Mirantis-Liberty-Xiaocong-regions/RegionOne/RegionOne-availability_zones/internal/node-6.cisco.com",
"name": "node-6.cisco.com",
"name_path": "/Mirantis-Liberty-Xiaocong/Regions/RegionOne/Availability Zones/internal/node-6.cisco.com",
"object_name": "node-6.cisco.com",
"parent_id": "internal",
"parent_type": "availability_zone",
"services": {
"nova-scheduler": {
"active": True,
"available": True,
"updated_at": "2016-10-21T18:01:10.000000"
},
"nova-consoleauth": {
"active": True,
"available": True,
"updated_at": "2016-10-21T18:01:54.000000"
},
"nova-conductor": {
"active": True,
"available": True,
"updated_at": "2016-10-21T18:01:45.000000"
},
"nova-cert": {
"active": True,
"available": True,
"updated_at": "2016-10-21T18:01:56.000000"
}
},
"show_in_tree": True,
"type": "host",
"zone": "internal"
}
DUMPXML = "\n instance-00000026\n bf0cb914-b316-486c-a4ce-f22deb453c52\n \n \n \n test\n 2016-10-17 22:37:43\n \n 64\n 0\n 0\n 0\n 1\n \n \n admin\n OSDNA-project\n \n \n \n \n 65536\n 65536\n 1\n \n 1024\n \n \n \n OpenStack Foundation\n OpenStack Nova\n 12.0.0\n 9cf57bfd-7477-4671-b2d3-3dfeebfefb1d\n bf0cb914-b316-486c-a4ce-f22deb453c52\n Virtual Machine\n \n \n \n hvm\n \n \n \n \n \n \n \n \n \n \n \n destroy\n restart\n destroy\n \n /usr/bin/qemu-system-x86_64\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n libvirt-bf0cb914-b316-486c-a4ce-f22deb453c52\n \n\n\n"
WRONG_DUMPXML = "wrong_instance"
INSTANCES_LIST = [
' Id Name State',
'----------------------------------------------------',
' 2 instance-00000002 running',
' 27 instance-0000001c running',
' 38 instance-00000026 running',
' 39 instance-00000028 running',
''
]
VNIC = {
"@type": "bridge",
"address": {
"@bus": "0x00",
"@domain": "0x0000",
"@function": "0x0",
"@slot": "0x03",
"@type": "pci"
},
"alias": {
"@name": "net0"
},
"driver": {
"@name": "qemu"
},
"mac": {
"@address": "fa:16:3e:e8:7f:04"
},
"model": {
"@type": "virtio"
},
"source": {
"@bridge": "qbr1f72bd15-8a"
},
"target": {
"@dev": "tap1f72bd15-8a"
}
}
ID = "38"
VNICS_FROM_DUMP_XML = [
{
"@type": "bridge",
"address": {
"@bus": "0x00",
"@domain": "0x0000",
"@function": "0x0",
"@slot": "0x03",
"@type": "pci"
},
"alias": {
"@name": "net0"
},
"driver": {
"@name": "qemu"
},
"host": "node-5.cisco.com",
"id": "tap1f72bd15-8a",
"instance_db_id": "5806817e4a0a8a3fbe3bee8b",
"instance_id": "bf0cb914-b316-486c-a4ce-f22deb453c52",
"mac": {
"@address": "fa:16:3e:e8:7f:04"
},
"mac_address": "fa:16:3e:e8:7f:04",
"model": {
"@type": "virtio"
},
"name": "tap1f72bd15-8a",
"source": {
"@bridge": "qbr1f72bd15-8a"
},
"source_bridge": "qbr1f72bd15-8a",
"target": {
"@dev": "tap1f72bd15-8a"
},
"vnic_type": "instance_vnic"
}
]
# functional test
INPUT = "bf0cb914-b316-486c-a4ce-f22deb453c52-vnics"