diff options
author | 2017-07-27 09:02:54 +0300 | |
---|---|---|
committer | 2017-07-27 14:56:25 +0300 | |
commit | 7e83d0876ddb84a45e130eeba28bc40ef53c074b (patch) | |
tree | 47d76239ae7658d87c66abd142df92709427e7dd /app/test/fetch/db_fetch/test_data | |
parent | 378ecbd8947589b9cbb39013a0c2e2aa201e03bd (diff) |
Calipso initial release for OPNFV
Change-Id: I7210c244b0c10fa80bfa8c77cb86c9d6ddf8bc88
Signed-off-by: Yaron Yogev <yaronyogev@gmail.com>
Diffstat (limited to 'app/test/fetch/db_fetch/test_data')
9 files changed, 644 insertions, 0 deletions
diff --git a/app/test/fetch/db_fetch/test_data/__init__.py b/app/test/fetch/db_fetch/test_data/__init__.py new file mode 100644 index 0000000..b0637e9 --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/__init__.py @@ -0,0 +1,9 @@ +############################################################################### +# 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 # +############################################################################### diff --git a/app/test/fetch/db_fetch/test_data/db_access.py b/app/test/fetch/db_fetch/test_data/db_access.py new file mode 100644 index 0000000..a4ad548 --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_access.py @@ -0,0 +1,40 @@ +############################################################################### +# 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 # +############################################################################### +DB_CONFIG = { + "host": "10.56.20.239", + "name": "mysql", + "password": "102QreDdiD5sKcvNf9qbHrmr", + "port": 3307.0, + "user": "root", + "schema": "nova" + } + +QUERY_WITHOUT_ID = """ + SELECT id, name + FROM nova.aggregates + WHERE deleted = 0 + """ + +QUERY_WITH_ID = """ + SELECT CONCAT('aggregate-', a.name, '-', host) AS id, host AS name + FROM nova.aggregate_hosts ah + JOIN nova.aggregates a ON a.id = ah.aggregate_id + WHERE ah.deleted = 0 AND aggregate_id = %s + """ + +ID = "2" +OBJECT_TYPE = "host aggregate" + +OBJECTS_LIST = [ + { + "id": 1, + "name": "osdna-agg" + } +] diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_aggregate_hosts.py b/app/test/fetch/db_fetch/test_data/db_fetch_aggregate_hosts.py new file mode 100644 index 0000000..2f1313a --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_aggregate_hosts.py @@ -0,0 +1,34 @@ +############################################################################### +# 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 # +############################################################################### +from bson.objectid import ObjectId + + +AGGREGATE = { + "id": "1", +} + +HOSTS = [ + { + "id": "aggregate-osdna-agg-node-5.cisco.com", + "name": "node-5.cisco.com" + } +] + +HOST_IN_INVENTORY = { + "_id": "595ac4b6d7c037efdb8918a7" +} + +HOSTS_RESULT = [ + { + "id": "aggregate-osdna-agg-node-5.cisco.com", + "name": "node-5.cisco.com", + "ref_id": ObjectId(HOST_IN_INVENTORY["_id"]) + } +] diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_aggregates.py b/app/test/fetch/db_fetch/test_data/db_fetch_aggregates.py new file mode 100644 index 0000000..65182fa --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_aggregates.py @@ -0,0 +1,17 @@ +############################################################################### +# 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 # +############################################################################### +REGION_ID = "RegionOne" + +OBJECTS_LIST = [ + { + "id": 1, + "name": "calipso-agg" + } +] diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_host_network_agents.py b/app/test/fetch/db_fetch/test_data/db_fetch_host_network_agents.py new file mode 100644 index 0000000..6188ddf --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_host_network_agents.py @@ -0,0 +1,65 @@ +############################################################################### +# 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 # +############################################################################### +CONFIG_WITH_MECHANISM_DRIVERS = { + 'mechanism_drivers': [ + "OVS" + ] +} + +CONFIG_WITHOUT_MECHANISM_DRIVERS = { + 'mechanism_drivers': [ + + ] +} + +NETWORK_AGENT_FOLDER_ID = 'node-6.cisco.com-network_agents' + +NETWORK_AGENT = [ + { + 'configurations': '{}', + 'id': '1764430c-c09e-4717-86fa-c04350b1fcbb', + 'binary': 'neutron-openvswitch-agent', + }, + { + 'configurations': '{}', + 'id': '2c2ddfee-91f9-47da-bd65-aceecd998b7c', + 'binary': 'neutron-dhcp-agent', + } +] + +NETWORK_AGENT_WITH_MECHANISM_DRIVERS_IN_CONFIG_RESULTS = [ + { + 'configurations': {}, + 'id': 'OVS-1764430c-c09e-4717-86fa-c04350b1fcbb', + 'binary': 'neutron-openvswitch-agent', + 'name': 'neutron-openvswitch-agent' + }, + { + 'configurations': {}, + 'id': 'OVS-2c2ddfee-91f9-47da-bd65-aceecd998b7c', + 'binary': 'neutron-dhcp-agent', + 'name': 'neutron-dhcp-agent' + } +] + +NETWORK_AGENT_WITHOUT_MECHANISM_DRIVERS_IN_CONFIG_RESULTS = [ + { + 'configurations': {}, + 'id': 'network_agent-1764430c-c09e-4717-86fa-c04350b1fcbb', + 'binary': 'neutron-openvswitch-agent', + 'name': 'neutron-openvswitch-agent' + }, + { + 'configurations': {}, + 'id': 'network_agent-2c2ddfee-91f9-47da-bd65-aceecd998b7c', + 'binary': 'neutron-dhcp-agent', + 'name': 'neutron-dhcp-agent' + } +] diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_instances.py b/app/test/fetch/db_fetch/test_data/db_fetch_instances.py new file mode 100644 index 0000000..5ba6a74 --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_instances.py @@ -0,0 +1,91 @@ +############################################################################### +# 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 # +############################################################################### +INSTANCES_FROM_API = [ + { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + } +] + +INSTANCES_FROM_DB = [ + { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + "network_info": "[{\"network\": {\"id\": \"7e59b726-d6f4-451a-a574-c67a920ff627\"}}]", + "project": "Calipso-project", + }, + { + "host": "node-5.cisco.com", + "id": "bf0cb914-b316-486c-a4ce-f22deb453c52", + "network_info": "[{\"network\": {\"id\": \"7e59b726-d6f4-451a-a574-c67a920ff627\"}}]", + "project": "Calipso-project", + } +] + +UPDATED_INSTANCES_DATA = [ + { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + "network": ["7e59b726-d6f4-451a-a574-c67a920ff627"], + "type": "instance", + "parent_type": "instances_folder", + "parent_id": "node-5.cisco.com-instances", + "in_project-Calipso-project": "1", + "network_info": [ + { + "network": { + "id": "7e59b726-d6f4-451a-a574-c67a920ff627" + } + } + ] + } +] + +INSTANCE_WITH_NETWORK = { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + "network_info": "[{\"network\": {\"id\": \"7e59b726-d6f4-451a-a574-c67a920ff627\"}}]", + "project": "Calipso-project", +} + +INSTANCE_WITH_NETWORK_RESULT = { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + "network": ["7e59b726-d6f4-451a-a574-c67a920ff627"], + "type": "instance", + "parent_type": "instances_folder", + "parent_id": "node-5.cisco.com-instances", + "in_project-Calipso-project": "1", + "network_info": [ + { + "network": { + "id": "7e59b726-d6f4-451a-a574-c67a920ff627" + } + } + ] +} + +INSTANCE_WITHOUT_NETWORK = { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + "network_info": "[]", + "project": "Calipso-project", +} + +INSTANCE_WITHOUT_NETWORK_RESULT = { + "host": "node-5.cisco.com", + "id": "6f29c867-9150-4533-8e19-70d749b172fa", + "network": [], + "type": "instance", + "parent_type": "instances_folder", + "parent_id": "node-5.cisco.com-instances", + "in_project-Calipso-project": "1", + "network_info": [] +} diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_oteps.py b/app/test/fetch/db_fetch/test_data/db_fetch_oteps.py new file mode 100644 index 0000000..a5bc63d --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_oteps.py @@ -0,0 +1,131 @@ +############################################################################### +# 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 # +############################################################################### +VEDGE_ID = "3858e121-d861-4348-9d64-a55fcd5bf60a" +VEDGE = { + "configurations": { + "tunnel_types": [ + "vxlan" + ], + "tunneling_ip": "192.168.2.1" + }, + "host": "node-5.cisco.com", + "id": "3858e121-d861-4348-9d64-a55fcd5bf60a", + "tunnel_ports": { + "vxlan-c0a80203": { + }, + "br-tun": { + } + }, + "type": "vedge" +} +VEDGE_WITHOUT_CONFIGS ={ + +} +VEDGE_WITHOUT_TUNNEL_TYPES = { + "configuration": { + "tunnel_types": "" + } +} +NON_ICEHOUSE_CONFIGS = { + "distribution": "Mirantis-8.0" +} +ICEHOUSE_CONFIGS = { + "distribution": "Canonical-icehouse" +} +HOST = { + "host": "node-5.cisco.com", + "id": "node-5.cisco.com", + "ip_address": "192.168.0.4", + "name": "node-5.cisco.com" +} +OTEPS_WITHOUT_CONFIGURATIONS_IN_VEDGE_RESULTS = [] +OTEPS_WITHOUT_TUNNEL_TYPES_IN_VEDGE_RESULTS = [] +OTEPS_FOR_NON_ICEHOUSE_DISTRIBUTION_RESULTS = [ + { + "host": "node-5.cisco.com", + "ip_address": "192.168.2.1", + "udp_port": 4789, + "id": "node-5.cisco.com-otep", + "name": "node-5.cisco.com-otep", + "overlay_type": "vxlan", + "ports": { + "vxlan-c0a80203": { + }, + "br-tun": { + } + } + } +] +OTEPS_FOR_ICEHOUSE_DISTRIBUTION_RESULTS = [ + { + "host": "node-5.cisco.com", + "ip_address": "192.168.0.4", + "id": "node-5.cisco.com-otep", + "name": "node-5.cisco.com-otep", + "overlay_type": "vxlan", + "ports": { + "vxlan-c0a80203": { + }, + "br-tun": { + } + }, + "udp_port": "67" + } +] + +OTEPS = [ + { + "host": "node-5.cisco.com", + "ip_address": "192.168.2.1", + "udp_port": 4789 + } +] + +OTEP_FOR_GETTING_VECONNECTOR = { + "host": "node-5.cisco.com", + "ip_address": "192.168.2.1", + "udp_port": 4789, + "id": "node-5.cisco.com-otep", + "name": "node-5.cisco.com-otep", + "overlay_type": "vxlan", + "ports": { + "vxlan-c0a80203": { + }, + "br-tun": { + } + } +} +HOST_ID = "node-5.cisco.com" +IFCONFIG_LINES = [ + "br-mesh Link encap:Ethernet HWaddr 00:50:56:ac:28:9d ", + " inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0", + " inet6 addr: fe80::d4e1:8fff:fe33:ed6a/64 Scope:Link", + " UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1", + " RX packets:2273307 errors:0 dropped:0 overruns:0 frame:0", + " TX packets:2255930 errors:0 dropped:0 overruns:0 carrier:0", + " collisions:0 txqueuelen:0 ", + " RX bytes:578536155 (578.5 MB) TX bytes:598541522 (598.5 MB)", + "" +] +OTEP_WITH_CONNECTOR = { + "host": "node-5.cisco.com", + "ip_address": "192.168.2.1", + "udp_port": 4789, + "id": "node-5.cisco.com-otep", + "name": "node-5.cisco.com-otep", + "overlay_type": "vxlan", + "ports": { + "vxlan-c0a80203": { + }, + "br-tun": { + } + }, + "vconnector": "br-mesh" +} diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_vedges_ovs.py b/app/test/fetch/db_fetch/test_data/db_fetch_vedges_ovs.py new file mode 100644 index 0000000..818704c --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_vedges_ovs.py @@ -0,0 +1,168 @@ +############################################################################### +# 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 # +############################################################################### +VEDGES_FOLDER_ID = "node-6.cisco.com-vedges" + +OBJECTS_FROM_DB = [ + { + "host": "node-6.cisco.com", + "agent_type": "Open vSwitch agent", + "configurations": '{"tunneling_ip": "192.168.2.3"}', + } +] + +HOST = { + "host": "node-6.cisco.com", + "host_type": [ + "Controller", + "Network" + ], + "id": "node-6.cisco.com", + "name": "node-6.cisco.com" +} + +HOST_WITHOUT_REQUIRED_HOST_TYPES = { + "id": "node-6.cisco.com", + "host_type": [] +} + +PORTS = { + "ovs-system": { + "name": "ovs-system", + "id": "0", + "internal": True + }, + "qr-bb9b8340-72": { + "name": "qr-bb9b8340-72", + "id": "1", + "internal": True, + "tag": "3" + }, + "qr-8733cc5d-b3": { + "name": "qr-8733cc5d-b3", + "id": "2", + "internal": True, + "tag": "4" + } +} + +TUNNEL_PORTS = { + "patch-int": { + "interface": "patch-int", + "name": "patch-int", + "options": { + "peer": "patch-tun" + }, + "type": "patch" + } +} + +GET_RESULTS = [ + { + 'name': 'node-6.cisco.com-OVS', + 'host': 'node-6.cisco.com', + 'agent_type': 'Open vSwitch agent', + 'configurations': {"tunneling_ip": "192.168.2.3"}, + 'ports': PORTS, + 'tunnel_ports': TUNNEL_PORTS + } +] + + +VSCTL_LINES = [ + "3b12f08e-4e13-4976-8da5-23314b268805", + " Bridge br-int", + " fail_mode: secure", + " Port \"qr-bb9b8340-72\"", + " tag: 3", + " Interface \"qr-bb9b8340-72\"", + " type: internal", + " Port \"qr-8733cc5d-b3\"", + " tag: 4", + " Interface \"qr-8733cc5d-b3\"", + " type: internal", + " Bridge br-tun", + " fail_mode: secure", + " Port patch-int", + " Interface patch-int", + " type: patch", + " options: {peer=patch-tun}", +] + +DPCTL_LINES = [ + "system@ovs-system:", + "\tlookups: hit:14039304 missed:35687906 lost:0", + "\tflows: 4", + "\tmasks: hit:95173613 total:2 hit/pkt:1.91", + "\tport 0: ovs-system (internal)", + "\tport 1: qr-bb9b8340-72 (internal)", + "\tport 2: qr-8733cc5d-b3 (internal)" +] + +DPCTL_RESULTS = { + "ovs-system": { + "name": "ovs-system", + "id": "0", + "internal": True + }, + "qr-bb9b8340-72": { + "name": "qr-bb9b8340-72", + "id": "1", + "internal": True + }, + "qr-8733cc5d-b3": { + "name": "qr-8733cc5d-b3", + "id": "2", + "internal": True + } +} + +FETCH__PORT_TAGS_INPUT = { + "ovs-system": { + "name": "ovs-system", + "id": "0", + "internal": True + }, + "qr-bb9b8340-72": { + "name": "qr-bb9b8340-72", + "id": "1", + "internal": True + }, + "qr-8733cc5d-b3": { + "name": "qr-8733cc5d-b3", + "id": "2", + "internal": True + } +} + +FETCH_PORT_TAGS_RESULT = { + "ovs-system": { + "name": "ovs-system", + "id": "0", + "internal": True + }, + "qr-bb9b8340-72": { + "name": "qr-bb9b8340-72", + "id": "1", + "internal": True, + "tag": "3" + }, + "qr-8733cc5d-b3": { + "name": "qr-8733cc5d-b3", + "id": "2", + "internal": True, + "tag": "4" + } +} + +DOC_TO_GET_OVERLAY = { + "host": "node-6.cisco.com", + "agent_type": "Open vSwitch agent", + "configurations": {"tunneling_ip": "192.168.2.3"}, +} diff --git a/app/test/fetch/db_fetch/test_data/db_fetch_vedges_vpp.py b/app/test/fetch/db_fetch/test_data/db_fetch_vedges_vpp.py new file mode 100644 index 0000000..24265ae --- /dev/null +++ b/app/test/fetch/db_fetch/test_data/db_fetch_vedges_vpp.py @@ -0,0 +1,89 @@ +############################################################################### +# 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 # +############################################################################### +VEDGE_FOLDER_ID = "ubuntu0-vedges" + +HOST = { + "host_type": [ + "Controller", + "Compute", + "Network" + ], + "id": "ubuntu0", +} + +HOST_WITHOUT_REQUIRED_HOST_TYPE = { + "host_type": [ + + ] +} + +VERSION = [ + "vpp v16.09-rc0~157-g203c632 built by localadmin on ubuntu0 at Sun Jun 26 16:35:15 PDT 2016\n" +] + +INTERFACES = [ + " Name Idx State Counter Count ", + "TenGigabitEthernetc/0/0 5 up rx packets 502022", + " rx bytes 663436206", + " tx packets 81404", + " tx bytes 6366378", + " drops 1414", + " punts 1", + " rx-miss 64525", + "VirtualEthernet0/0/0 7 up tx packets 31496", + " tx bytes 2743185", + "local0 0 down ", + "pg/stream-0 1 down ", +] + +PORTS = { + "TenGigabitEthernetc/0/0": { + "id": "5", + "name": "TenGigabitEthernetc/0/0", + "state": "up" + }, + "VirtualEthernet0/0/0": { + "id": "7", + "name": "VirtualEthernet0/0/0", + "state": "up" + }, + "local0": { + "id": "0", + "name": "local0", + "state": "down" + }, + "pg/stream-0": { + "id": "1", + "name": "pg/stream-0", + "state": "down" + } +} + + +VEDGE_RESULTS = [ + { + "host": "ubuntu0", + "id": "ubuntu0-VPP", + "name": "VPP-ubuntu0", + "agent_type": "VPP", + "binary": "vpp v16.09-rc0~157-g203c632", + "ports": PORTS + } +] + +VEDGE_RESULTS_WITHOUT_BINARY = [ + { + "host": "ubuntu0", + "id": "ubuntu0-VPP", + "name": "VPP-ubuntu0", + "agent_type": "VPP", + "ports": PORTS + } +] |