From 5ffa7838e9ca0e0e0d44d2cd2c7b3d5ba45d329d Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Tue, 12 Sep 2017 15:43:00 -0600 Subject: [PATCH] Retire Packaging Deb project repos This commit is part of a series to retire the Packaging Deb project. Step 2 is to remove all content from the project repos, replacing it with a README notification where to find ongoing work, and how to recover the repo if needed at some future point (as in https://docs.openstack.org/infra/manual/drivers.html#retiring-a-project). Change-Id: Ia695114b58b3acc31bfb5857aa2483c9e92d7f92 --- .coveragerc | 7 - .gitignore | 27 - .gitreview | 4 - .mailmap | 3 - .pylintrc | 89 --- .testr.conf | 8 - CONTRIBUTING.rst | 1 - HACKING.rst | 4 - LICENSE | 176 ----- MANIFEST.in | 6 - README | 14 + README.rst | 33 - babel.cfg | 2 - devstack/README.rst | 1 - devstack/lib/nec_plugin | 57 -- devstack/override-defaults | 4 - devstack/plugin.sh | 27 - devstack/settings | 10 - doc/source/conf.py | 75 -- doc/source/contributing.rst | 20 - doc/source/images/necnwa-plugin-design.png | Bin 54427 -> 0 bytes doc/source/index.rst | 59 -- doc/source/nwa/devstack.rst | 47 -- doc/source/nwa/installation.rst | 30 - doc/source/nwa/readme.rst | 22 - doc/source/nwa/settings.rst | 187 ----- doc/source/tips.rst | 147 ---- etc/neutron/plugins/nec/necnwa.ini | 29 - etc/neutron/plugins/nec/resource_group.json | 52 -- networking_nec/__init__.py | 19 - networking_nec/_i18n.py | 30 - networking_nec/cmd/__init__.py | 0 networking_nec/cmd/eventlet/__init__.py | 15 - networking_nec/cmd/eventlet/nwa_agent.py | 19 - networking_nec/common/__init__.py | 0 networking_nec/common/utils.py | 53 -- networking_nec/db/__init__.py | 0 networking_nec/db/migration/__init__.py | 0 .../migration/alembic_migrations/__init__.py | 0 .../db/migration/alembic_migrations/env.py | 89 --- .../alembic_migrations/script.py.mako | 20 - .../alembic_migrations/versions/HEAD | 1 - .../versions/d86043b2d0f2_add_a_table.py | 51 -- .../versions/start_networking_nec.py | 30 - networking_nec/nwa/__init__.py | 0 networking_nec/nwa/agent/__init__.py | 0 networking_nec/nwa/agent/nwa_agent.py | 164 ----- networking_nec/nwa/agent/proxy_l2.py | 640 ----------------- networking_nec/nwa/agent/proxy_l3.py | 440 ------------ networking_nec/nwa/agent/proxy_tenant.py | 109 --- networking_nec/nwa/agent/server_manager.py | 130 ---- networking_nec/nwa/common/__init__.py | 0 networking_nec/nwa/common/config.py | 100 --- networking_nec/nwa/common/constants.py | 24 - networking_nec/nwa/common/exceptions.py | 39 -- networking_nec/nwa/common/utils.py | 66 -- networking_nec/nwa/l2/__init__.py | 0 networking_nec/nwa/l2/db_api.py | 200 ------ networking_nec/nwa/l2/drivers/__init__.py | 0 networking_nec/nwa/l2/drivers/mech_necnwa.py | 261 ------- networking_nec/nwa/l2/models.py | 61 -- networking_nec/nwa/l2/plugin.py | 183 ----- networking_nec/nwa/l2/rpc/__init__.py | 0 .../nwa/l2/rpc/ml2_server_callback.py | 128 ---- networking_nec/nwa/l2/rpc/nwa_agent_api.py | 38 - .../nwa/l2/rpc/nwa_agent_callback.py | 45 -- .../nwa/l2/rpc/nwa_l2_server_api.py | 89 --- .../nwa/l2/rpc/nwa_l2_server_callback.py | 138 ---- networking_nec/nwa/l2/rpc/nwa_proxy_api.py | 57 -- .../nwa/l2/rpc/nwa_proxy_callback.py | 44 -- .../nwa/l2/rpc/tenant_binding_api.py | 75 -- .../nwa/l2/rpc/tenant_binding_callback.py | 137 ---- networking_nec/nwa/l2/utils.py | 150 ---- networking_nec/nwa/l3/__init__.py | 0 networking_nec/nwa/l3/db_api.py | 31 - networking_nec/nwa/l3/plugin.py | 229 ------ networking_nec/nwa/l3/rpc/__init__.py | 0 networking_nec/nwa/l3/rpc/nwa_l3_proxy_api.py | 63 -- .../nwa/l3/rpc/nwa_l3_proxy_callback.py | 44 -- .../nwa/l3/rpc/nwa_l3_server_api.py | 38 - .../nwa/l3/rpc/nwa_l3_server_callback.py | 45 -- networking_nec/nwa/nwalib/__init__.py | 0 networking_nec/nwa/nwalib/client.py | 33 - networking_nec/nwa/nwalib/client_fwaas.py | 40 -- networking_nec/nwa/nwalib/client_l2.py | 148 ---- networking_nec/nwa/nwalib/client_l3.py | 117 ---- networking_nec/nwa/nwalib/client_lbaas.py | 84 --- networking_nec/nwa/nwalib/client_tenant.py | 33 - networking_nec/nwa/nwalib/data_utils.py | 189 ----- networking_nec/nwa/nwalib/exceptions.py | 25 - networking_nec/nwa/nwalib/nwa_restclient.py | 271 -------- networking_nec/nwa/nwalib/restclient.py | 148 ---- networking_nec/nwa/nwalib/semaphore.py | 62 -- networking_nec/nwa/nwalib/workflow.py | 178 ----- networking_nec/tests/__init__.py | 0 networking_nec/tests/unit/__init__.py | 0 networking_nec/tests/unit/nwa/__init__.py | 0 .../tests/unit/nwa/agent/__init__.py | 0 networking_nec/tests/unit/nwa/agent/base.py | 61 -- .../add_router_interface_nwa_info.json | 26 - .../add_router_interface_nwa_info_2.json | 26 - .../create_general_dev_nwa_info.json | 28 - .../create_general_dev_nwa_info_2.json | 28 - .../test_data/create_general_dev_result.json | 14 - .../test_data/create_tenant_nw_result.json | 28 - .../agent/test_data/create_vlan_result.json | 23 - .../delete_general_dev_nwa_info.json | 27 - .../test_data/delete_general_dev_result.json | 13 - .../delete_general_dev_result_fail.json | 13 - .../test_data/delete_tenant_nw_result.json | 25 - .../agent/test_data/delete_vlan_result.json | 12 - .../expected_proxy_create_vlan_succeed1.json | 10 - .../test_data/nwa_data_check_segment.json | 24 - .../nwa_data_create_general_dev_ex1.json | 23 - .../nwa_data_create_general_dev_succeed2.json | 21 - .../nwa_data_create_general_dev_succeed3.json | 21 - .../nwa_data_delete_general_dev_succeed1.json | 21 - .../nwa_data_delete_general_dev_succeed2.json | 27 - .../nwa_data_delete_general_dev_succeed3.json | 29 - .../nwa_data_delete_vlan_succeed1.json | 26 - .../nwa_data_get_resource_group_name.json | 21 - .../test_data/nwa_data_one_general_dev.json | 25 - .../test_data/nwa_data_two_general_dev.json | 39 -- .../nwa_data_two_port_general_dev.json | 31 - .../nwa_data_two_port_general_dev_fail.json | 26 - .../nwa_info_create_general_dev_ex1.json | 28 - .../nwa_info_create_general_dev_succeed1.json | 27 - .../nwa_info_create_general_dev_succeed2.json | 27 - .../nwa_info_create_general_dev_succeed3.json | 27 - .../nwa_info_delete_general_dev_succeed1.json | 27 - .../nwa_info_delete_general_dev_succeed2.json | 27 - .../nwa_info_delete_general_dev_succeed3.json | 27 - .../nwa_info_get_resource_group_name.json | 27 - .../tests/unit/nwa/agent/test_nwa_agent.py | 74 -- .../tests/unit/nwa/agent/test_proxy_l2.py | 532 -------------- .../tests/unit/nwa/agent/test_proxy_tenant.py | 109 --- .../unit/nwa/agent/test_server_manager.py | 89 --- .../tests/unit/nwa/common/__init__.py | 0 .../tests/unit/nwa/common/test_config.py | 63 -- .../tests/unit/nwa/common/test_utils.py | 87 --- networking_nec/tests/unit/nwa/l2/__init__.py | 0 .../tests/unit/nwa/l2/drivers/__init__.py | 0 .../unit/nwa/l2/drivers/test_mech_necnwa.py | 655 ------------------ .../tests/unit/nwa/l2/rpc/__init__.py | 0 .../nwa/l2/rpc/test_ml2_server_callback.py | 244 ------- .../unit/nwa/l2/rpc/test_nwa_agent_api.py | 38 - .../nwa/l2/rpc/test_nwa_agent_callback.py | 43 -- .../unit/nwa/l2/rpc/test_nwa_l2_server_api.py | 34 - .../nwa/l2/rpc/test_nwa_l2_server_callback.py | 47 -- .../unit/nwa/l2/rpc/test_nwa_proxy_api.py | 54 -- .../nwa/l2/rpc/test_nwa_proxy_callback.py | 36 - .../l2/rpc/test_tenant_binding_callback.py | 82 --- .../tests/unit/nwa/l2/test_db_api.py | 450 ------------ .../tests/unit/nwa/l2/test_models.py | 36 - .../tests/unit/nwa/l2/test_plugin.py | 238 ------- .../tests/unit/nwa/l2/test_utils.py | 359 ---------- networking_nec/tests/unit/nwa/l3/__init__.py | 0 .../tests/unit/nwa/l3/rpc/__init__.py | 0 .../unit/nwa/l3/rpc/test_nwa_l3_proxy_api.py | 82 --- .../tests/unit/nwa/l3/test_plugin.py | 110 --- .../tests/unit/nwa/nwalib/__init__.py | 0 .../tests/unit/nwa/nwalib/test_client.py | 45 -- .../unit/nwa/nwalib/test_client_fwaas.py | 37 - .../tests/unit/nwa/nwalib/test_client_l2.py | 258 ------- .../tests/unit/nwa/nwalib/test_client_l3.py | 169 ----- .../unit/nwa/nwalib/test_client_tenant.py | 57 -- .../tests/unit/nwa/nwalib/test_exceptions.py | 24 - .../unit/nwa/nwalib/test_nwa_restclient.py | 237 ------- .../tests/unit/nwa/nwalib/test_restclient.py | 103 --- .../tests/unit/nwa/nwalib/test_semaphore.py | 58 -- .../tests/unit/nwa/nwalib/test_workflow.py | 86 --- requirements.txt | 27 - rpm/neutron-necnwa-agent.service | 12 - rpm/neutron-necnwa-cleanup | 76 -- rpm/neutron-necnwa-cleanup.service | 12 - setup.cfg | 66 -- setup.py | 29 - test-requirements.txt | 22 - tools/coding-checks.sh | 58 -- tools/pretty_tox.sh | 13 - tools/tox_install.sh | 52 -- tox.ini | 52 -- 182 files changed, 14 insertions(+), 12390 deletions(-) delete mode 100644 .coveragerc delete mode 100644 .gitignore delete mode 100644 .gitreview delete mode 100644 .mailmap delete mode 100644 .pylintrc delete mode 100644 .testr.conf delete mode 120000 CONTRIBUTING.rst delete mode 100644 HACKING.rst delete mode 100644 LICENSE delete mode 100644 MANIFEST.in create mode 100644 README delete mode 100644 README.rst delete mode 100644 babel.cfg delete mode 120000 devstack/README.rst delete mode 100644 devstack/lib/nec_plugin delete mode 100644 devstack/override-defaults delete mode 100644 devstack/plugin.sh delete mode 100644 devstack/settings delete mode 100755 doc/source/conf.py delete mode 100644 doc/source/contributing.rst delete mode 100644 doc/source/images/necnwa-plugin-design.png delete mode 100644 doc/source/index.rst delete mode 100644 doc/source/nwa/devstack.rst delete mode 100644 doc/source/nwa/installation.rst delete mode 100644 doc/source/nwa/readme.rst delete mode 100644 doc/source/nwa/settings.rst delete mode 100644 doc/source/tips.rst delete mode 100644 etc/neutron/plugins/nec/necnwa.ini delete mode 100644 etc/neutron/plugins/nec/resource_group.json delete mode 100644 networking_nec/__init__.py delete mode 100644 networking_nec/_i18n.py delete mode 100644 networking_nec/cmd/__init__.py delete mode 100644 networking_nec/cmd/eventlet/__init__.py delete mode 100755 networking_nec/cmd/eventlet/nwa_agent.py delete mode 100644 networking_nec/common/__init__.py delete mode 100644 networking_nec/common/utils.py delete mode 100644 networking_nec/db/__init__.py delete mode 100644 networking_nec/db/migration/__init__.py delete mode 100644 networking_nec/db/migration/alembic_migrations/__init__.py delete mode 100644 networking_nec/db/migration/alembic_migrations/env.py delete mode 100644 networking_nec/db/migration/alembic_migrations/script.py.mako delete mode 100644 networking_nec/db/migration/alembic_migrations/versions/HEAD delete mode 100644 networking_nec/db/migration/alembic_migrations/versions/d86043b2d0f2_add_a_table.py delete mode 100644 networking_nec/db/migration/alembic_migrations/versions/start_networking_nec.py delete mode 100644 networking_nec/nwa/__init__.py delete mode 100644 networking_nec/nwa/agent/__init__.py delete mode 100644 networking_nec/nwa/agent/nwa_agent.py delete mode 100644 networking_nec/nwa/agent/proxy_l2.py delete mode 100644 networking_nec/nwa/agent/proxy_l3.py delete mode 100644 networking_nec/nwa/agent/proxy_tenant.py delete mode 100644 networking_nec/nwa/agent/server_manager.py delete mode 100644 networking_nec/nwa/common/__init__.py delete mode 100644 networking_nec/nwa/common/config.py delete mode 100644 networking_nec/nwa/common/constants.py delete mode 100644 networking_nec/nwa/common/exceptions.py delete mode 100644 networking_nec/nwa/common/utils.py delete mode 100644 networking_nec/nwa/l2/__init__.py delete mode 100644 networking_nec/nwa/l2/db_api.py delete mode 100644 networking_nec/nwa/l2/drivers/__init__.py delete mode 100644 networking_nec/nwa/l2/drivers/mech_necnwa.py delete mode 100644 networking_nec/nwa/l2/models.py delete mode 100644 networking_nec/nwa/l2/plugin.py delete mode 100644 networking_nec/nwa/l2/rpc/__init__.py delete mode 100644 networking_nec/nwa/l2/rpc/ml2_server_callback.py delete mode 100644 networking_nec/nwa/l2/rpc/nwa_agent_api.py delete mode 100644 networking_nec/nwa/l2/rpc/nwa_agent_callback.py delete mode 100644 networking_nec/nwa/l2/rpc/nwa_l2_server_api.py delete mode 100644 networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py delete mode 100644 networking_nec/nwa/l2/rpc/nwa_proxy_api.py delete mode 100644 networking_nec/nwa/l2/rpc/nwa_proxy_callback.py delete mode 100644 networking_nec/nwa/l2/rpc/tenant_binding_api.py delete mode 100644 networking_nec/nwa/l2/rpc/tenant_binding_callback.py delete mode 100644 networking_nec/nwa/l2/utils.py delete mode 100644 networking_nec/nwa/l3/__init__.py delete mode 100644 networking_nec/nwa/l3/db_api.py delete mode 100644 networking_nec/nwa/l3/plugin.py delete mode 100644 networking_nec/nwa/l3/rpc/__init__.py delete mode 100644 networking_nec/nwa/l3/rpc/nwa_l3_proxy_api.py delete mode 100644 networking_nec/nwa/l3/rpc/nwa_l3_proxy_callback.py delete mode 100644 networking_nec/nwa/l3/rpc/nwa_l3_server_api.py delete mode 100644 networking_nec/nwa/l3/rpc/nwa_l3_server_callback.py delete mode 100644 networking_nec/nwa/nwalib/__init__.py delete mode 100644 networking_nec/nwa/nwalib/client.py delete mode 100644 networking_nec/nwa/nwalib/client_fwaas.py delete mode 100644 networking_nec/nwa/nwalib/client_l2.py delete mode 100644 networking_nec/nwa/nwalib/client_l3.py delete mode 100644 networking_nec/nwa/nwalib/client_lbaas.py delete mode 100644 networking_nec/nwa/nwalib/client_tenant.py delete mode 100644 networking_nec/nwa/nwalib/data_utils.py delete mode 100644 networking_nec/nwa/nwalib/exceptions.py delete mode 100644 networking_nec/nwa/nwalib/nwa_restclient.py delete mode 100644 networking_nec/nwa/nwalib/restclient.py delete mode 100644 networking_nec/nwa/nwalib/semaphore.py delete mode 100644 networking_nec/nwa/nwalib/workflow.py delete mode 100644 networking_nec/tests/__init__.py delete mode 100644 networking_nec/tests/unit/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/agent/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/agent/base.py delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info_2.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info_2.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_result.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/create_tenant_nw_result.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/create_vlan_result.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_nwa_info.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result_fail.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/delete_tenant_nw_result.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/delete_vlan_result.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/expected_proxy_create_vlan_succeed1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_check_segment.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_ex1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed2.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed3.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed2.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed3.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_vlan_succeed1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_get_resource_group_name.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_one_general_dev.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_general_dev.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev_fail.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_ex1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed2.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed3.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed1.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed2.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed3.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_data/nwa_info_get_resource_group_name.json delete mode 100644 networking_nec/tests/unit/nwa/agent/test_nwa_agent.py delete mode 100644 networking_nec/tests/unit/nwa/agent/test_proxy_l2.py delete mode 100644 networking_nec/tests/unit/nwa/agent/test_proxy_tenant.py delete mode 100644 networking_nec/tests/unit/nwa/agent/test_server_manager.py delete mode 100644 networking_nec/tests/unit/nwa/common/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/common/test_config.py delete mode 100644 networking_nec/tests/unit/nwa/common/test_utils.py delete mode 100644 networking_nec/tests/unit/nwa/l2/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/l2/drivers/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_api.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_callback.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_api.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_api.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_callback.py delete mode 100644 networking_nec/tests/unit/nwa/l2/rpc/test_tenant_binding_callback.py delete mode 100644 networking_nec/tests/unit/nwa/l2/test_db_api.py delete mode 100644 networking_nec/tests/unit/nwa/l2/test_models.py delete mode 100644 networking_nec/tests/unit/nwa/l2/test_plugin.py delete mode 100644 networking_nec/tests/unit/nwa/l2/test_utils.py delete mode 100644 networking_nec/tests/unit/nwa/l3/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/l3/rpc/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/l3/rpc/test_nwa_l3_proxy_api.py delete mode 100644 networking_nec/tests/unit/nwa/l3/test_plugin.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/__init__.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_client.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_client_fwaas.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_client_l2.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_client_l3.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_client_tenant.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_exceptions.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_nwa_restclient.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_restclient.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_semaphore.py delete mode 100644 networking_nec/tests/unit/nwa/nwalib/test_workflow.py delete mode 100644 requirements.txt delete mode 100644 rpm/neutron-necnwa-agent.service delete mode 100755 rpm/neutron-necnwa-cleanup delete mode 100644 rpm/neutron-necnwa-cleanup.service delete mode 100644 setup.cfg delete mode 100644 setup.py delete mode 100644 test-requirements.txt delete mode 100644 tools/coding-checks.sh delete mode 100755 tools/pretty_tox.sh delete mode 100755 tools/tox_install.sh delete mode 100644 tox.ini diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 09d8b7f..0000000 --- a/.coveragerc +++ /dev/null @@ -1,7 +0,0 @@ -[run] -branch = True -source = networking_nec -omit = networking_nec/tests/*,networking_nec/openstack/* - -[report] -ignore_errors = True diff --git a/.gitignore b/.gitignore deleted file mode 100644 index f944514..0000000 --- a/.gitignore +++ /dev/null @@ -1,27 +0,0 @@ -*.py[cod] - -# Packages -*.egg-info -dist/ - -# Unit test / coverage reports -cover/ -.coverage -.tox -.testrepository -.venv - -# Translations -*.mo - -# Sphinx -doc/build - -# pbr generates these -AUTHORS -ChangeLog - -# Editors -*~ -.*.swp -.*sw? diff --git a/.gitreview b/.gitreview deleted file mode 100644 index 9262758..0000000 --- a/.gitreview +++ /dev/null @@ -1,4 +0,0 @@ -[gerrit] -host=review.openstack.org -port=29418 -project=openstack/networking-nec.git diff --git a/.mailmap b/.mailmap deleted file mode 100644 index 516ae6f..0000000 --- a/.mailmap +++ /dev/null @@ -1,3 +0,0 @@ -# Format is: -# -# diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index 3375026..0000000 --- a/.pylintrc +++ /dev/null @@ -1,89 +0,0 @@ -# The format of this file isn't really documented; just use --generate-rcfile -[MASTER] -# Add to the black list. It should be a base name, not a -# path. You may set this option multiple times. -# -# Note the 'openstack' below is intended to match only -# networking_nec.openstack.common. If we ever have another 'openstack' -# dirname, then we'll need to expand the ignore features in pylint :/ -ignore=.git,tests,openstack - -[MESSAGES CONTROL] -# NOTE(gus): This is a long list. A number of these are important and -# should be re-enabled once the offending code is fixed (or marked -# with a local disable) -disable= -# "F" Fatal errors that prevent further processing -# flake8 detects import-error - import-error, -# "I" Informational noise - locally-disabled, -# "E" Error for important programming issues (likely bugs) -# "W" Warnings for stylistic problems or minor programming issues - attribute-defined-outside-init, - broad-except, - fixme, - global-statement, - no-init, - protected-access, - unpacking-non-sequence, - unused-argument, - unused-import, -# "C" Coding convention violations -# pylint check is not compatible with flake8 - bad-continuation, - invalid-name, - missing-docstring, -# "R" Refactor recommendations - duplicate-code, - interface-not-implemented, - no-self-use, - too-few-public-methods, - too-many-ancestors, - too-many-arguments, - too-many-return-statements, - -[BASIC] -# Variable names can be 1 to 31 characters long, with lowercase and underscores -variable-rgx=[a-z_][a-z0-9_]{0,30}$ - -# Argument names can be 2 to 31 characters long, with lowercase and underscores -argument-rgx=[a-z_][a-z0-9_]{1,30}$ - -# Method names should be at least 3 characters long -# and be lowecased with underscores -method-rgx=([a-z_][a-z0-9_]{2,}|setUp|tearDown)$ - -# Module names matching neutron-* are ok (files in bin/) -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+)|(neutron-[a-z0-9_-]+))$ - -# Don't require docstrings on tests. -no-docstring-rgx=((__.*__)|([tT]est.*)|setUp|tearDown)$ - -[FORMAT] -# Maximum number of characters on a single line. -max-line-length=79 - -[VARIABLES] -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -# _ is used by our localization -dummy-variables-rgx=^(__[A-Za-z0-9_]*[A-Za-z0-9]|__)$ - -[CLASSES] -# List of interface methods to ignore, separated by a comma. -ignore-iface-methods= - -[IMPORTS] -# Deprecated modules which should not be used, separated by a comma -deprecated-modules= -# should use openstack.common.jsonutils - json - -[TYPECHECK] -# List of module names for which member attributes should not be checked -ignored-modules=six.moves,_MovedItems - -[REPORTS] -# Tells whether to display a full report or only the messages -reports=no diff --git a/.testr.conf b/.testr.conf deleted file mode 100644 index 2c07076..0000000 --- a/.testr.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \ - OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \ - OS_LOG_CAPTURE=${OS_LOG_CAPTURE:-1} \ - OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \ - ${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION -test_id_option=--load-list $IDFILE -test_list_option=--list diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 120000 index a84afb3..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1 +0,0 @@ -doc/source/contributing.rst \ No newline at end of file diff --git a/HACKING.rst b/HACKING.rst deleted file mode 100644 index 0dbe072..0000000 --- a/HACKING.rst +++ /dev/null @@ -1,4 +0,0 @@ -networking-nec Style Commandments -=============================================== - -Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/ diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 68c771a..0000000 --- a/LICENSE +++ /dev/null @@ -1,176 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index c978a52..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -include AUTHORS -include ChangeLog -exclude .gitignore -exclude .gitreview - -global-exclude *.pyc diff --git a/README b/README new file mode 100644 index 0000000..8fcd2b2 --- /dev/null +++ b/README @@ -0,0 +1,14 @@ +This project is no longer maintained. + +The contents of this repository are still available in the Git +source code management system. To see the contents of this +repository before it reached its end of life, please check out the +previous commit with "git checkout HEAD^1". + +For ongoing work on maintaining OpenStack packages in the Debian +distribution, please see the Debian OpenStack packaging team at +https://wiki.debian.org/OpenStack/. + +For any further questions, please email +openstack-dev@lists.openstack.org or join #openstack-dev on +Freenode. diff --git a/README.rst b/README.rst deleted file mode 100644 index 1df899b..0000000 --- a/README.rst +++ /dev/null @@ -1,33 +0,0 @@ -=================================================== -Neutron plugins/drivers for NEC networking products -=================================================== - -.. warning:: - - The current plugin, NEC OpenFlow plugin, is deprecated in - OpenStack Liberty release (2015.2). - A new driver for NEC NWA (Network Automation) product is coming. - Note that the production support will be continued based - on the production support policy. - -``networking-nec`` library provides Neutron plugins/drivers -for `NEC SDN`_ networking products` (mainly OpenFlow related at now) -and `Trema`_ `Sliceable Switch`_ (reference implementation). - -In 2015.1 release (Kilo development cycle) in OpenStack, Neutron -community decided to decompose vendor plugins/drivers from the neutron -code repo to address many pain points. NEC OpenFlow Neutron plugin is -maintained in a separate module. - -* Documentation: https://wiki.openstack.org/wiki/Neutron/NEC_OpenFlow_Plugin -* Source: - - * http://git.openstack.org/cgit/openstack/networking-nec - * https://github.com/openstack/networking-nec - -* Bugs: http://bugs.launchpad.net/networking-nec -* Free software: Apache license - -.. _NEC SDN: http://www.necam.com/SDN/ -.. _Trema: https://github.com/trema/trema -.. _Sliceable Switch: https://github.com/trema/apps/tree/master/sliceable_switch diff --git a/babel.cfg b/babel.cfg deleted file mode 100644 index 15cd6cb..0000000 --- a/babel.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[python: **.py] - diff --git a/devstack/README.rst b/devstack/README.rst deleted file mode 120000 index 8b57ead..0000000 --- a/devstack/README.rst +++ /dev/null @@ -1 +0,0 @@ -../doc/source/nwa/devstack.rst \ No newline at end of file diff --git a/devstack/lib/nec_plugin b/devstack/lib/nec_plugin deleted file mode 100644 index 4f7473c..0000000 --- a/devstack/lib/nec_plugin +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# Save trace setting -NEC_XTRACE=$(set +o | grep xtrace) -set +o xtrace - -# source $TOP_DIR/lib/neutron_plugins/ovs_base -source $TOP_DIR/lib/neutron_plugins/openvswitch_agent - -# The followig functions are from the above openvswitch_agent. -# If some change is needed, let's redefine the function. -# -# neutron_plugin_create_nova_conf -# neutron_plugin_install_agent_packages -# neutron_plugin_configure_debug_command -# neutron_plugin_configure_dhcp_agent -# neutron_plugin_configure_l3_agent -# neutron_plugin_configure_plugin_agent -# neutron_plugin_setup_interface_driver -# neutron_plugin_check_adv_test_requirements - -# Neutron-server functions required by devstack neutron plugin interfaces. - -function neutron_plugin_configure_common { - Q_PLUGIN_CONF_PATH=etc/neutron/plugins/nec - Q_PLUGIN_CONF_FILENAME=necnwa.ini - Q_PLUGIN_CLASS="necnwa" - if [ -n "$NECNWA_L3_PLUGIN" ]; then - _neutron_service_plugin_class_add $NECNWA_L3_PLUGIN - fi - local plugin_conf_src_abspath=${NETWORKING_NEC_DIR}/${Q_PLUGIN_CONF_PATH} - local plugin_conf_sys_abspath=/${Q_PLUGIN_CONF_PATH} - mkdir -p ${plugin_conf_sys_abspath} - cp ${plugin_conf_src_abspath}/${Q_PLUGIN_CONF_FILENAME} ${plugin_conf_sys_abspath}/ - cp ${plugin_conf_src_abspath}/resource_group.json ${plugin_conf_sys_abspath}/ - chmod 0644 /${Q_PLUGIN_CONF_PATH}/${Q_PLUGIN_CONF_FILENAME} -} - -function neutron_plugin_configure_service { - iniset /$Q_PLUGIN_CONF_FILE NWA server_url $NECNWA_SERVER_URL - iniset /$Q_PLUGIN_CONF_FILE NWA access_key_id $NECNWA_ACCESS_KEY_ID - iniset /$Q_PLUGIN_CONF_FILE NWA secret_access_key $NECNWA_SECRET_ACCESS_KEY - iniset /$Q_PLUGIN_CONF_FILE NWA use_necnwa_router $NECNWA_USE_NECNWA_ROUTER -} - -# NEC plugin specific functions - -function start_nwa_agent { - run_process nwa-agt "$NEUTRON_BIN_DIR/neutron-necnwa-agent --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE" -} - -function populate_nwa_database { - $NEUTRON_BIN_DIR/neutron-db-manage --subproject networking-nec --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head -} - -# Restore xtrace -$NEC_XTRACE diff --git a/devstack/override-defaults b/devstack/override-defaults deleted file mode 100644 index 626940f..0000000 --- a/devstack/override-defaults +++ /dev/null @@ -1,4 +0,0 @@ -function has_neutron_plugin_security_group { - # 0 means True here - return 0 -} diff --git a/devstack/plugin.sh b/devstack/plugin.sh deleted file mode 100644 index 786bf36..0000000 --- a/devstack/plugin.sh +++ /dev/null @@ -1,27 +0,0 @@ -NETWORKING_NEC_DIR=$(cd $(dirname $BASH_SOURCE)/.. && pwd) - -function source_plugin { - if [[ "$Q_PLUGIN" == "nec" ]]; then - source $NETWORKING_NEC_DIR/devstack/lib/nec_plugin - fi -} - -if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then - source_plugin -elif [[ "$1" == "stack" && "$2" == "install" ]]; then - setup_develop $NETWORKING_NEC_DIR -elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - # This must be done after neutron database is populated and - # before starting neutron server. - populate_nwa_database - # It needs to be started before starting neutron-server. - # run_phase extra is too late because create_neutron_initial_network - # will be called just after start_neutron_service_and_check. - start_nwa_agent -elif [[ "$1" == "stack" && "$2" == "extra" ]]; then - : -elif [[ "$1" == "unstack" ]]; then - source_plugin -elif [[ "$1" == "clean" ]]; then - source_plugin -fi diff --git a/devstack/settings b/devstack/settings deleted file mode 100644 index b048bde..0000000 --- a/devstack/settings +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -NECNWA_SERVER_URL=${NECNWA_SERVER_URL:-} -NECNWA_ACCESS_KEY_ID=${NECNWA_ACCESS_KEY_ID:-} -NECNWA_SECRET_ACCESS_KEY=${NECNWA_SECRET_ACCESS_KEY:-} -NECNWA_USE_NECNWA_ROUTER=${NECNWA_USE_NECNWA_ROUTER:-True} -NECNWA_L3_PLUGIN=${NECNWA_L3_PLUGIN:-"necnwa_router"} - -# In addition to the above, you can use configurartion options -# used in devstack/lib/neutron_plugins/openvswitch_agent. diff --git a/doc/source/conf.py b/doc/source/conf.py deleted file mode 100755 index 93c4223..0000000 --- a/doc/source/conf.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os -import sys - -sys.path.insert(0, os.path.abspath('../..')) -# -- General configuration ---------------------------------------------------- - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = [ - 'sphinx.ext.autodoc', - # 'sphinx.ext.intersphinx', - # 'oslosphinx' -] - -# autodoc generation is a bit aggressive and a nuisance when doing heavy -# text edit cycles. -# execute "export SPHINX_DEBUG=1" in your terminal to disable - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = u'networking-nec' -copyright = u'2013, OpenStack Foundation' - -# If true, '()' will be appended to :func: etc. cross-reference text. -add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -add_module_names = True - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# -- Options for HTML output -------------------------------------------------- - -# The theme to use for HTML and HTML Help pages. Major themes that come with -# Sphinx are currently 'default' and 'sphinxdoc'. -# html_theme_path = ["."] -# html_theme = '_theme' -# html_static_path = ['static'] - -# Output file base name for HTML help builder. -htmlhelp_basename = '%sdoc' % project - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass -# [howto/manual]). -latex_documents = [ - ('index', - '%s.tex' % project, - u'%s Documentation' % project, - u'OpenStack Foundation', 'manual'), -] - -# Example configuration for intersphinx: refer to the Python standard library. -# intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst deleted file mode 100644 index 3a8b538..0000000 --- a/doc/source/contributing.rst +++ /dev/null @@ -1,20 +0,0 @@ -============ -Contributing -============ - -If you would like to contribute to the development of OpenStack, -you must follow the steps in this page: - - http://docs.openstack.org/infra/manual/developers.html - -Once those steps have been completed, changes to OpenStack -should be submitted for review via the Gerrit tool, following -the workflow documented at: - - http://docs.openstack.org/infra/manual/developers.html#development-workflow - -Pull requests submitted through GitHub will be ignored. - -Bugs should be filed on Launchpad, not GitHub: - - https://bugs.launchpad.net/networking-nec diff --git a/doc/source/images/necnwa-plugin-design.png b/doc/source/images/necnwa-plugin-design.png deleted file mode 100644 index c5592d7d59d32f5d118db2e1f49e8de983a8811f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54427 zcmb5Vby!=^^9G8Ppusgb6n6+x+@UxWEv_Y{NDCBq2+-nCT!IB{p|r)_ibDxbk>c*I zH+;Uod;h=t@Ps@$yJz>z&b~AA&YWl+EfpXR2nPiP1^7}`Q4a+Ltr-OcbqNa%`HPfJ zb^r>>gw0DuIeqWBy#Oi4`M;NKk&g-gMD4EdsdE2edpN=r&}nV@h!r9M;uB-}P<$mj zcDRB7Rp_>!MkJFU=_ww;1{KbM&XLfwiTq_=3>k$ETAUq19Vk9X&~XdK81}f?y0bHx z#4}hEfWJ||?%N=4)VS#`efig&E4jbhb72bNbUC_!^MCDA!v6mL&1$3bJP9Y6EZ(ix zr7j=)|JwVpj>Z}+N0hjb{qbB#;iEDM>Hk_vfA<~aT3LU_dazk;sm=UsF`uF9qo2-re6(dh|VHmHDQL>#m37&L=!?S_ZHG{t3I}n}sU7IH%n+{V44TT4~;~ca>MI zF|STfBgc?K#~HYril;_-yXH^pNb0Cso5sQ8tMfBMeDFgkG?--&9ZZVn3orX4cKmwy z@}!d8u}>u#3#2oE1ro0kM}GN0cHnUn`@8rBpCb$|Fz^y+k!;GaXnw;OF}Ht1iT|;2 z>&<%G#OG|vaq5dL!hhCAOnbgoZF}AQ$`fSelk6{B|iT!?x~+Vrg~i;iU#s8h{Gyv@pmk;y3q`vAfS|a ztH%6AL3q{g$Zm|#r1o02t|rl|gV9?J91(oxD+KE=6e5w>%2=GjtM z^IG1hHtqCno@=|LJ~lh#(QgdVoO9gD(o^Nff>%BC~=j<`-wxs&?a2!uwQXm#3 z)PhlHK?(nqFsbd^QNXpa36TV{wV*(9&Itvh#04}zc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PCG}7_F%+ZJ=ynTcEwxm z^#)2sPX*^BTyV!a7Q&2xWUwykL|)Oq6g1tlr^3R0OmoTPZe_>C?N8 zo?N(?mXxJSGuIC@WIcMJyZ2&LG|;Ubofnk8PUqdu+rz>eHl#m5mwCW`bF|a?4lBa1 x=WS>H-@-p_PA;Pmd^X0S3pO#rtd0$M4E0U)^3OU({11WA^!We) diff --git a/doc/source/index.rst b/doc/source/index.rst deleted file mode 100644 index e4ec006..0000000 --- a/doc/source/index.rst +++ /dev/null @@ -1,59 +0,0 @@ -.. networking-nec documentation master file, created by - sphinx-quickstart on Tue Jul 9 22:26:36 2013. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -=========================================== -Neutron plugins for NEC networking products -=========================================== - -``networking-nec`` library provides Neutron plugins/drivers -for `NEC SDN `_ networking products. - -* Documentation: http://networking-nec.readthedocs.org/ -* Source: http://git.openstack.org/cgit/openstack/networking-nec -* Bugs: http://bugs.launchpad.net/networking-nec -* License: Apache License 2.0 - -NEC NWA plugin -============== - -In Mitaka release, NWA plugin was added as a new integration layer -with NEC NWA (Network Automation) product. -NWA plugin consists of layer-2 core plugin and layer-3 service plugin. - -.. toctree:: - :maxdepth: 1 - - nwa/readme - nwa/installation - nwa/settings - nwa/devstack - -NEC OpenFlow plugin -=================== - -NEC OpenFlow plugin in Liberty or older releases supported -`NEC ProgrammableFlow controller `_ and -`Trema `_ -`Sliceable Switch `_ -(as reference implementation). - -.. warning:: - - NEC OpenFlow plugin was deprecated in OpenStack Liberty release (2015.2) - and removed during Mitaka development cycle. - Note that the production support will be continued based - on the production support policy. - -The documentation on NEC OpenFlow plugin is found at -http://networking-nec.readthedocs.org/en/stable-liberty/. - -Developers Guide -================ - -.. toctree:: - :maxdepth: 2 - - tips - contributing diff --git a/doc/source/nwa/devstack.rst b/doc/source/nwa/devstack.rst deleted file mode 100644 index 3d2470f..0000000 --- a/doc/source/nwa/devstack.rst +++ /dev/null @@ -1,47 +0,0 @@ -.. _nwa-devstack: - -=============================== -DevStack support for NWA plugin -=============================== - -This DevStack external plugin installs NEC plugin library -so that Neutron NEC NWA plugin can be enabled. - -To use this DevStack plugin, add the following to your local.conf:: - - enable_plugin networking-nec https://git.openstack.org/openstack/networking-nec [] - -Examples -======== - -Minimum sample local.conf:: - - [[local|localrc]] - # Enable neutron services - disable_service n-net - enable_service neutron q-svc q-agt - enable_service q-dhcp - enable_service q-meta - - # NEC plugin - Q_PLUGIN=nec - enable_plugin networking-nec https://git.openstack.org/openstack/networking-nec - - # NWA server configurations - NECNWA_SERVER_URL="http://127.0.0.1:12081" - NECNWA_ACCESS_KEY_ID="mjivAk6O3G4Ko/0mD8mHUyQwqugEPgTe0FSli8REyN4=" - NECNWA_SECRET_ACCESS_KEY="/3iSORtq1E3F+SQtQg6YN00eM3GUda0EKqWDUV/mvqo=" - - # Run neutron-nwa-agent - enable_service nwa-agt - - [[post-config|/etc/neutron/dhcp_agent.ini]] - [DEFAULT] - enable_isolated_metadata = True - -References -========== - -* `DevStack externally hosted plugins`_ - -.. _DevStack externally hosted plugins: http://docs.openstack.org/developer/devstack/plugins.html#externally-hosted-plugins diff --git a/doc/source/nwa/installation.rst b/doc/source/nwa/installation.rst deleted file mode 100644 index 0870f0c..0000000 --- a/doc/source/nwa/installation.rst +++ /dev/null @@ -1,30 +0,0 @@ -============================== -Installation of NEC NWA plugin -============================== - -Requirements -============ - -To use the NWA plugin, NWA made by NEC is needed. - -After an OpenStack installation, you need to install networking-nec -Python package, configure the physical network by NWA and configure -the NWA plugin. - -Running with DevStack -===================== - -See :ref:`nwa-devstack` - -Manual Installation -=================== - -The released versions of Python module is available at -https://pypi.python.org/pypi/networking-nec. - -To install:: - - pip install networking-nec~=2.0 - -NEC NWA plugin is available from version ``2.0.0`` or later. -The ``2.y.z`` series of networking-nec supports Neutron Mitaka release. diff --git a/doc/source/nwa/readme.rst b/doc/source/nwa/readme.rst deleted file mode 100644 index e54d503..0000000 --- a/doc/source/nwa/readme.rst +++ /dev/null @@ -1,22 +0,0 @@ -============================== -Introduction of NEC NWA plugin -============================== - -.. toctree:: - :maxdepth: 1 - - Installation - Settings - DevStack support - -The NWA plugin consists of plugin driver and agent. -Using this plugin, you can operate an SDN controller (MasterScope -Network Automation) made by NEC from OpenStack CLI or Dashboard. - -NWA can build a large scale layer 2 network which removes the 4K VLAN -limit. -So you can use the NWA plugin to create, update and delete the network -through OpenStack environment. - -.. image:: ../images/necnwa-plugin-design.png - :width: 700px diff --git a/doc/source/nwa/settings.rst b/doc/source/nwa/settings.rst deleted file mode 100644 index 0acc86d..0000000 --- a/doc/source/nwa/settings.rst +++ /dev/null @@ -1,187 +0,0 @@ -=============================== -Setting of NEC NWA plugin -=============================== - -This section describes the configurations of the releases of NEC NWA plugin. - -neutron.conf -============ - -* **core_plugin**: Needs to be configured to ``necnwa`` to use NEC NWA - plugin as core plugin. :: - - core_plugin = necnwa - -* **service_plugin**: Needs to be configured to ``necnwa_router`` to use - NEC NWA plugin as service plugin. :: - - service_plugin = necnwa_router - -plugin specific configuration -============================= - -It is usually placed at ``/etc/neutron/plugins/nec/necnwa.ini``. - -[ml2] section -------------- - -* **type_drivers**: Needs to be configured to ``vlan`` to use NEC NWA - plugin as type_drivers. :: - - type_drivers = vlan - -* **tenant_network_types**: Needs to be configured to ``vlan`` to use - NEC NWA plugin as tenant_network_types. :: - - tenant_network_types = vlan - -* **mechanism_drivers**: Needs to be configured to ``necnwa`` and - ``openvswitch`` to use NEC NWA plugin as mechanism_drivers. :: - - mechanism_drivers = necnwa,openvswitch - -[ml2_type_vlan] section ------------------------ - -* **network_vlan_ranges**: Specify the name of an available physical - network and a range of VIDs on that network available for allocation - to tenant networks. The physical network should be the same name of - NWA resource group name. :: - - network_vlan_ranges = OpenStack/DC/APP:1000:2999,OpenStack/DC/HA1:10:2999,OpenStack/DC/HA2:10:2999 - -[ovs] section -------------- - -* **bridge_mappings**: Specify list of : - tuples, each specifying an OVS bridge used by the agent for a - physical network to which it is connected. :: - - bridge_mappings = OpenStack/DC/HA1:br-eth1,OpenStack/DC/HA2:br-eth2 - -[NWA] section -------------- - -* **server_url**: The URL of the http/https server listening for NWA - RESTful API:: - - server_url = http://192.168.122.1:12081 - -* **access_key_id**: The access key ID of NWA RESTful API server. The - access key consists of an access key ID and secret access key, which - are used to sign RESTful API requests that you make to NWA. :: - - access_key_id = mjivAk6O3G4Ko/0mD8mHUyQwqugEPgTe0FSli8REyN4= - -* **secret_access_key**: The secret access key of NWA Restful API - server. The access key consists of an access key ID and secret - access key, which are used to sign RESTful API requests that you - make to NWA. :: - - secret_access_key = /3iSORtq1E3F+SQtQg6YN00eM3GUda0EKqWDUV/mvqo= - -* **resource_group_name**: A default rerouce group name when NWA - tenant is created. :: - - resource_group_name = OpenStack/DC/APP - -* **scenario_polling_timer**: Specifies the polling interval of the - scenario in seconds. :: - - scenario_polling_timer = 5 - -* **scenario_polling_count**: Specifies the polling counts of the - scenario. :: - - scenario_polling_count = 300 - -* **region_name**: A region name (It is the prefix of NWA tenant name). :: - - region_name = T01DC - -* **resource_group_file**: Load the table of NWA resource group - from the file. :: - - resource_group_file = resource_group.json - -* **use_necnwa_router**: If you use OpenStack L3 Router instead of NEC NWA Router, - it set to False. The default value is True. :: - - use_necnwa_router = True - -* **use_neutron_vlan_id**: If you want to use a vlan id which is - assigned by neutron, it set to True. The default value is False. In - case of False, the vlan id will be assigned by NWA. :: - - use_neutron_vlan_id = True - -NWA resource group file -======================= - -It is usually placed at -"/etc/neutron/plugins/nec/resource_group.json." - -This file contains a table of NWA resource group. The format of the -file is JSON. - -The ``physical_network`` is a name of physical network which is used -in neutron. It should be set to the same value as -``ResourceGroupName`` member. - -The ``device_owner`` is the owner of the device in OpenStack. - -It is specified as ``compute:AVAILABILITY_ZONE``, the VM that has a -nova boot option ``--available-zone`` is created on the physical -network corresponding with the device owner. - -If the option ``--available-zone`` is not specified in nova boot, -regarded as ``compute:None`` has been specified. - -All available DHCP agent in OpenStack specifies as ``network:dhcp``. - -The ``ResourceGroupName`` is a name of NWA's resource group name. - -:: - - [ - { - "physical_network": "OpenStack/DC/HA1", - "device_owner": "compute:DC01_KVM01_ZONE01", - "ResourceGroupName": "OpenStack/DC/HA1" - }, - { - "physical_network": "OpenStack/DC/HA2", - "device_owner": "compute:DC01_KVM02_ZONE02", - "ResourceGroupName": "OpenStack/DC/HA2" - }, - { - "physical_network": "OpenStack/DC/HA1", - "device_owner": "compute:None", - "ResourceGroupName": "OpenStack/DC/HA1" - }, - { - "physical_network": "OpenStack/DC/HA2", - "device_owner": "compute:None", - "ResourceGroupName": "OpenStack/DC/HA2" - }, - { - "physical_network": "OpenStack/DC/HA1", - "device_owner": "network:dhcp", - "ResourceGroupName": "OpenStack/DC/HA1" - }, - { - "physical_network": "OpenStack/DC/HA2", - "device_owner": "network:dhcp", - "ResourceGroupName": "OpenStack/DC/HA2" - }, - { - "physical_network": "OpenStack/DC/APP", - "device_owner": "network:router_gateway", - "ResourceGroupName": "OpenStack/DC/APP" - }, - { - "physical_network": "OpenStack/DC/APP", - "device_owner": "network:router_interface", - "ResourceGroupName": "OpenStack/DC/APP" - }, - ] diff --git a/doc/source/tips.rst b/doc/source/tips.rst deleted file mode 100644 index 56b46b3..0000000 --- a/doc/source/tips.rst +++ /dev/null @@ -1,147 +0,0 @@ -================ -Development Tips -================ - -Release package ---------------- - -Create a specific release -~~~~~~~~~~~~~~~~~~~~~~~~~ - -The following steps are required to release a package. - -* (Create a stable branch if necessary) -* Add a signed tag to the repository - - .. code-block:: console - - git checkout stable/xxxx (if necessary) - git tag -s - git show - git push gerrit - - .. warning:: - - Before pushing a tag to gerrit, you are strongly suggested to - test whether a generated package works as expected. - - .. code-block:: console - - git checkout - python setup.py sdist - pip install dist/networking-nec-.tar.gz - - To push a tag to gerrit, you must be a member of - ``networking-nec-release`` gerrit group. - -* Push a release package to PyPI. - - .. code-block:: console - - git checkout - python setup.py sdist upload - - Once the upload succeeded, you can find a new release at - https://pypi.python.org/pypi/networking-nec. - - Before uploading a package to PyPI, you need to create your PyPI - account and prepare a proper credential file ``~/.pypirc`` like below. - - .. code-block:: ini - - [distutils] - index-servers = - pypi - - [pypi] - repository=https://pypi.python.org/pypi - username= - password= - -Create a stable branch -~~~~~~~~~~~~~~~~~~~~~~ - -The detail is available at: -http://docs.openstack.org/infra/manual/drivers.html#release-management. - -To create a (stable) branch, you must be a member of -``networking-nec-release`` gerrit group. - -More information -~~~~~~~~~~~~~~~~ - -Most of the release process is explained in -`OpenStack Infrastructure User Manual -`_. - -Requirements update -------------------- - -In OpenStack projects, requirements.txt and test-requirements.txt -should be synced with ``global-requirements.txt`` in -http://git.openstack.org/cgit/openstack/requirements/tree/. - -To sync requirements manually: - -1. Check out requirements repository: - - .. code-block:: console - - git clone https://git.openstack.org/openstack/requirements - -2. Run update.py: - - .. code-block:: console - - cd requirements - tox -e venv -- python update.py - -To sync it automatically, you need to: - -* setup the jenkins job ``gate-{name}-requirements`` - (it is usually unnecessary as ``python-jobs`` contains it), -* add ``check-requirements`` to ``zuul/layout.yaml`` in - project-config, and -* add ``openstack/networking-nec`` to ``projects.txt`` in the - requirements project. - -Documentation -------------- - -Build documentation -~~~~~~~~~~~~~~~~~~~ - -To build the documentation: - -.. code-block:: console - - tox -e docs - -and the generated documentation will be found under ``doc/build/html``. - -Publish documentation -~~~~~~~~~~~~~~~~~~~~~ - -The document is hosted by `Read The Docs `__ -and the documentation is available at -http://networking-nec.readthedocs.org/en/latest/. - -To publish the latest documentation, -visit the `project page `__, -go to **Builds** and click **Build version** after selecting **latest**. -After completing the build, the status will be **Passed** and -you can see the new document. -If the build fails, investigate reasons of the failure. - -Third party CI --------------- - -* The master information about setting up and operating a third party CI - is available at - http://docs.openstack.org/infra/system-config/third_party.html. - It is better to check this site regularly. - -* The status of your third party CI system should be available at - https://wiki.openstack.org/wiki/ThirdPartySystems. - For example, you have a planned power blackout, it is encouraged - to update the corresponding page. diff --git a/etc/neutron/plugins/nec/necnwa.ini b/etc/neutron/plugins/nec/necnwa.ini deleted file mode 100644 index 80e6156..0000000 --- a/etc/neutron/plugins/nec/necnwa.ini +++ /dev/null @@ -1,29 +0,0 @@ -[ml2] -type_drivers = vlan -tenant_network_types = vlan -mechanism_drivers = necnwa,openvswitch -path_mtu = 0 - -[ml2_type_flat] - -[ml2_type_vlan] -network_vlan_ranges = OpenStack/DC/APP:1000:2999,OpenStack/DC/HA1:10:2999,OpenStack/DC/HA2:10:2999 - -[ml2_type_gre] - -[ml2_type_vxlan] - -[securitygroup] -enable_security_group = True - -[NWA] -server_url = http://192.168.122.166:12081 -access_key_id = mjivAk6O3G4Ko/0mD8mHUyQwqugEPgTe0FSli8REyN4= -secret_access_key = /3iSORtq1E3F+SQtQg6YN00eM3GUda0EKqWDUV/mvqo= -use_necnwa_router = True -use_neutron_vlan_id = False -resource_group_name = OpenStack/DC/APP -scenario_polling_timer = 5 -scenario_polling_count = 300 -region_name = T01DC -resource_group_file = resource_group.json diff --git a/etc/neutron/plugins/nec/resource_group.json b/etc/neutron/plugins/nec/resource_group.json deleted file mode 100644 index 65685e0..0000000 --- a/etc/neutron/plugins/nec/resource_group.json +++ /dev/null @@ -1,52 +0,0 @@ -[ - { - "physical_network": "OpenStack/DC/HA1", - "device_owner": "compute:DC01_KVM01_ZONE01", - "ResourceGroupName": "OpenStack/DC/HA1" - }, - { - "physical_network": "OpenStack/DC/HA2", - "device_owner": "compute:DC01_KVM02_ZONE02", - "ResourceGroupName": "OpenStack/DC/HA2" - }, - { - "physical_network": "OpenStack/DC/HA1", - "device_owner": "compute:None", - "ResourceGroupName": "OpenStack/DC/HA1" - }, - { - "physical_network": "OpenStack/DC/HA2", - "device_owner": "compute:None", - "ResourceGroupName": "OpenStack/DC/HA2" - }, - { - "physical_network": "OpenStack/DC/HA1", - "device_owner": "network:dhcp", - "ResourceGroupName": "OpenStack/DC/HA1" - }, - { - "physical_network": "OpenStack/DC/HA2", - "device_owner": "network:dhcp", - "ResourceGroupName": "OpenStack/DC/HA2" - }, - { - "physical_network": "OpenStack/DC/APP", - "device_owner": "network:router_gateway", - "ResourceGroupName": "OpenStack/DC/APP" - }, - { - "physical_network": "OpenStack/DC/APP", - "device_owner": "network:router_interface", - "ResourceGroupName": "OpenStack/DC/APP" - }, - { - "physical_network": "Common/BM/Pod2-Ironic", - "device_owner": "compute:DC01_BMT01_ZONE01", - "ResourceGroupName": "Common/BM/Pod2-Ironic" - }, - { - "physical_network": "Common/BM/Pod2-Ironic", - "device_owner": "ironic:isolation", - "ResourceGroupName": "Common/BM/Pod2-Ironic" - } -] diff --git a/networking_nec/__init__.py b/networking_nec/__init__.py deleted file mode 100644 index b80e859..0000000 --- a/networking_nec/__init__.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- - -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import pbr.version - - -__version__ = pbr.version.VersionInfo( - 'networking_nec').version_string() diff --git a/networking_nec/_i18n.py b/networking_nec/_i18n.py deleted file mode 100644 index 7047ce1..0000000 --- a/networking_nec/_i18n.py +++ /dev/null @@ -1,30 +0,0 @@ -# All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import oslo_i18n - -_translators = oslo_i18n.TranslatorFactory(domain='networking_nec') - -# The primary translation function using the well-known name "_" -_ = _translators.primary - -# Translators for log levels. -# -# The abbreviated names are meant to reflect the usual use of a short -# name like '_'. The "L" is for "log" and the other letter comes from -# the level. -_LI = _translators.log_info -_LW = _translators.log_warning -_LE = _translators.log_error -_LC = _translators.log_critical diff --git a/networking_nec/cmd/__init__.py b/networking_nec/cmd/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/cmd/eventlet/__init__.py b/networking_nec/cmd/eventlet/__init__.py deleted file mode 100644 index 01f9f69..0000000 --- a/networking_nec/cmd/eventlet/__init__.py +++ /dev/null @@ -1,15 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.common import eventlet_utils - -eventlet_utils.monkey_patch() diff --git a/networking_nec/cmd/eventlet/nwa_agent.py b/networking_nec/cmd/eventlet/nwa_agent.py deleted file mode 100755 index 0fd11e0..0000000 --- a/networking_nec/cmd/eventlet/nwa_agent.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from networking_nec.nwa.agent import nwa_agent - - -def main(): - nwa_agent.main() diff --git a/networking_nec/common/__init__.py b/networking_nec/common/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/common/utils.py b/networking_nec/common/utils.py deleted file mode 100644 index 8a5cc6e..0000000 --- a/networking_nec/common/utils.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import functools - -from oslo_log import log -from oslo_utils import excutils - -from networking_nec._i18n import _LE - - -LOG = log.getLogger(__name__) - - -def _get_full_class_name(cls): - return '%s.%s' % (cls.__module__, - getattr(cls, '__qualname__', cls.__name__)) - - -def log_method_return_value(method): - - @functools.wraps(method) - def wrapper(*args, **kwargs): - first_arg = args[0] - cls = (first_arg if isinstance(first_arg, type) - else first_arg.__class__) - data = {'class_name': _get_full_class_name(cls), - 'method_name': method.__name__} - try: - ret = method(*args, **kwargs) - data['ret'] = ret - LOG.debug('%(class_name)s method %(method_name)s ' - 'call returned %(ret)s', data) - return ret - except Exception as e: - with excutils.save_and_reraise_exception(): - data['exctype'] = e.__class__.__name__ - data['reason'] = e - LOG.error(_LE('%(class_name)s method %(method_name)s ' - 'call raised %(exctype)s: %(reason)s'), data) - - return wrapper diff --git a/networking_nec/db/__init__.py b/networking_nec/db/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/db/migration/__init__.py b/networking_nec/db/migration/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/db/migration/alembic_migrations/__init__.py b/networking_nec/db/migration/alembic_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/db/migration/alembic_migrations/env.py b/networking_nec/db/migration/alembic_migrations/env.py deleted file mode 100644 index 3c5fdd9..0000000 --- a/networking_nec/db/migration/alembic_migrations/env.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2015 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# pylint: disable=no-member -# Silence pylint not complain about alembic.context. - -from logging import config as logging_config - -from alembic import context -from neutron_lib.db import model_base -from oslo_config import cfg -from oslo_db.sqlalchemy import session -import sqlalchemy as sa -from sqlalchemy import event - - -MYSQL_ENGINE = None -NEC_VERSION_TABLE = 'alembic_version_networking_nec' -config = context.config -neutron_config = config.neutron_config -logging_config.fileConfig(config.config_file_name) -target_metadata = model_base.BASEV2.metadata - - -def set_mysql_engine(): - try: - mysql_engine = neutron_config.command.mysql_engine - except cfg.NoSuchOptError: - mysql_engine = None - - global MYSQL_ENGINE - MYSQL_ENGINE = (mysql_engine or - model_base.BASEV2.__table_args__['mysql_engine']) - - -def run_migrations_offline(): - set_mysql_engine() - - kwargs = {} - if neutron_config.database.connection: - kwargs['url'] = neutron_config.database.connection - else: - kwargs['dialect_name'] = neutron_config.database.engine - kwargs['version_table'] = NEC_VERSION_TABLE - context.configure(**kwargs) - - with context.begin_transaction(): - context.run_migrations() - - -@event.listens_for(sa.Table, 'after_parent_attach') -def set_storage_engine(target, parent): - if MYSQL_ENGINE: - target.kwargs['mysql_engine'] = MYSQL_ENGINE - - -def run_migrations_online(): - set_mysql_engine() - engine = session.create_engine(neutron_config.database.connection) - - connection = engine.connect() - context.configure( - connection=connection, - target_metadata=target_metadata, - version_table=NEC_VERSION_TABLE - ) - try: - with context.begin_transaction(): - context.run_migrations() - finally: - connection.close() - engine.dispose() - - -if context.is_offline_mode(): - run_migrations_offline() -else: - run_migrations_online() diff --git a/networking_nec/db/migration/alembic_migrations/script.py.mako b/networking_nec/db/migration/alembic_migrations/script.py.mako deleted file mode 100644 index 8323caa..0000000 --- a/networking_nec/db/migration/alembic_migrations/script.py.mako +++ /dev/null @@ -1,20 +0,0 @@ -"""${message} - -Revision ID: ${up_revision} -Revises: ${down_revision | comma,n} -Create Date: ${create_date} - -""" - -# revision identifiers, used by Alembic. -revision = ${repr(up_revision)} -down_revision = ${repr(down_revision)} -branch_labels = ${repr(branch_labels)} -depends_on = ${repr(depends_on)} - -from alembic import op -import sqlalchemy as sa -${imports if imports else ""} - -def upgrade(): - ${upgrades if upgrades else "pass"} diff --git a/networking_nec/db/migration/alembic_migrations/versions/HEAD b/networking_nec/db/migration/alembic_migrations/versions/HEAD deleted file mode 100644 index 76960e2..0000000 --- a/networking_nec/db/migration/alembic_migrations/versions/HEAD +++ /dev/null @@ -1 +0,0 @@ -d86043b2d0f2 diff --git a/networking_nec/db/migration/alembic_migrations/versions/d86043b2d0f2_add_a_table.py b/networking_nec/db/migration/alembic_migrations/versions/d86043b2d0f2_add_a_table.py deleted file mode 100644 index 007d90f..0000000 --- a/networking_nec/db/migration/alembic_migrations/versions/d86043b2d0f2_add_a_table.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright 2016 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""Add tables for necnwa - -Revision ID: d86043b2d0f2 -Revises: 978466bef2fe -Create Date: 2016-01-12 14:36:11.217570 - -""" - -# revision identifiers, used by Alembic. -revision = 'd86043b2d0f2' -down_revision = '978466bef2fe' - -from alembic import op -import sqlalchemy as sa - - -def upgrade(): - op.create_table( - 'nwa_tenant_key_value', - sa.Column('tenant_id', sa.String(length=36), - nullable=False, primary_key=True), - sa.Column('nwa_tenant_id', sa.String(length=64)), - sa.Column('json_key', sa.String(length=192), - nullable=False, primary_key=True), - sa.Column('json_value', sa.String(length=1024), - nullable=False, default='') - ) - - op.create_table( - 'nwa_tenant_queue', - sa.Column('tenant_id', sa.String(length=36), - nullable=False, primary_key=True), - sa.Column('nwa_tenant_id', sa.String(length=64), - nullable=False, default=''), - sa.Column('topic', sa.String(length=122), nullable=False, default='') - ) diff --git a/networking_nec/db/migration/alembic_migrations/versions/start_networking_nec.py b/networking_nec/db/migration/alembic_migrations/versions/start_networking_nec.py deleted file mode 100644 index 9d0e5f9..0000000 --- a/networking_nec/db/migration/alembic_migrations/versions/start_networking_nec.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2016 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# - -"""start networking-nec db migration - -Revision ID: 978466bef2fe -Revises: None -Create Date: 2016-02-06 20:30:12.217571 - -""" - -# revision identifiers, used by Alembic. -revision = '978466bef2fe' -down_revision = None - - -def upgrade(): - pass diff --git a/networking_nec/nwa/__init__.py b/networking_nec/nwa/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/agent/__init__.py b/networking_nec/nwa/agent/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/agent/nwa_agent.py b/networking_nec/nwa/agent/nwa_agent.py deleted file mode 100644 index 6a73e14..0000000 --- a/networking_nec/nwa/agent/nwa_agent.py +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import socket -import sys -import time - -from neutron.agent import rpc as agent_rpc -from neutron.common import config as logging_config -from neutron.common import rpc as n_rpc -from neutron.common import topics -from neutron import context as q_context -from oslo_config import cfg -from oslo_log import log as logging -from oslo_service import loopingcall - -from networking_nec._i18n import _LE -from networking_nec.nwa.agent import proxy_l2 -from networking_nec.nwa.agent import proxy_l3 -from networking_nec.nwa.agent import proxy_tenant -from networking_nec.nwa.agent import server_manager -from networking_nec.nwa.common import constants as nwa_const -from networking_nec.nwa.l2.rpc import nwa_agent_callback -from networking_nec.nwa.l2.rpc import nwa_proxy_callback -from networking_nec.nwa.l2.rpc import tenant_binding_api -from networking_nec.nwa.l3.rpc import nwa_l3_proxy_callback -from networking_nec.nwa.nwalib import client as nwa_cli - - -LOG = logging.getLogger(__name__) - - -# pylint: disable=too-many-instance-attributes -class NECNWANeutronAgent(object): - - rpc_servers = {} - topic = nwa_const.NWA_AGENT_TOPIC - - def __init__(self, polling_interval): - """Constructor. - - @param polling_interval: interval (secs) to check the nwa. - """ - self.polling_interval = polling_interval - self.need_sync = True - - self.conf = cfg.CONF - self.host = socket.gethostname() - self.agent_id = 'necnwa-q-agent.%s' % self.host - self.multi_dc = cfg.CONF.NWA.use_neutron_vlan_id - self.client = nwa_cli.NwaClient() - - self.agent_state = { - 'binary': 'neutron-necnwa-agent', - 'host': cfg.CONF.host, - 'topic': nwa_const.NWA_AGENT_TOPIC, - 'configurations': {}, - 'agent_type': nwa_const.NWA_AGENT_TYPE, - 'start_flag': True} - - self.server_manager = server_manager.ServerManager(self.topic, self) - self.proxy_tenant = proxy_tenant.AgentProxyTenant(self, self.client) - self.proxy_l2 = proxy_l2.AgentProxyL2(self, self.client, self.multi_dc) - self.proxy_l3 = proxy_l3.AgentProxyL3(self, self.client, self.multi_dc) - self.setup_rpc() - - LOG.debug('NWA Agent state %s', self.agent_state) - - def setup_rpc(self): - """setup_rpc """ - - self.context = q_context.get_admin_context_without_session() - - self.nwa_l2_rpc = tenant_binding_api.TenantBindingServerRpcApi( - topics.PLUGIN - ) - - self.state_rpc = agent_rpc.PluginReportStateAPI(topics.REPORTS) - self.callback_nwa = nwa_agent_callback.NwaAgentRpcCallback( - self.context, self.server_manager) - self.callback_proxy = nwa_proxy_callback.NwaProxyCallback( - self.context, self.proxy_l2) - self.callback_l3 = nwa_l3_proxy_callback.NwaL3ProxyCallback( - self.context, self.proxy_l3) - - # lbaas - self.lbaas_driver = None - self.callback_lbaas = None - if self.conf.NWA.lbaas_driver: - pass - - # fwaas - self.fwaas_driver = None - self.callback_fwaas = None - if self.conf.NWA.fwaas_driver: - pass - - # endpoints - self.endpoints = [self.callback_nwa, - self.callback_proxy, - self.callback_l3] - - # create connection - self.conn = n_rpc.create_connection() - - self.conn.create_consumer(self.topic, self.endpoints, - fanout=False) - - self.conn.consume_in_threads() - - report_interval = cfg.CONF.AGENT.report_interval - if report_interval: - heartbeat = loopingcall.FixedIntervalLoopingCall( - self._report_state) - heartbeat.start(interval=report_interval) - - def _report_state(self): - try: - queues = self.server_manager.get_rpc_server_topics() - self.agent_state['configurations']['tenant_queues'] = len(queues) - self.state_rpc.report_state(self.context, - self.agent_state) - self.agent_state.pop('start_flag', None) - - servers = self.server_manager.get_rpc_server_tenant_ids() - self.nwa_l2_rpc.update_tenant_rpc_servers( - self.context, servers - ) - - except Exception as e: - LOG.exception(_LE("Failed reporting state! %s"), e) - - def loop_handler(self): - pass - - def daemon_loop(self): - """Main processing loop for NECNWA Plugin Agent.""" - while True: - self.loop_handler() - time.sleep(self.polling_interval) - - -def main(): - logging_config.init(sys.argv[1:]) - logging_config.setup_logging() - - polling_interval = cfg.CONF.AGENT.polling_interval - agent = NECNWANeutronAgent(polling_interval) - - agent.daemon_loop() - -if __name__ == "__main__": - main() diff --git a/networking_nec/nwa/agent/proxy_l2.py b/networking_nec/nwa/agent/proxy_l2.py deleted file mode 100644 index e42e8df..0000000 --- a/networking_nec/nwa/agent/proxy_l2.py +++ /dev/null @@ -1,640 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import re -import time - -from neutron.common import topics -from neutron.plugins.common import constants as plugin_const -from neutron.plugins.ml2 import driver_api as api -from oslo_log import helpers -from oslo_log import log as logging -import six - -from networking_nec._i18n import _LE, _LI, _LW -from networking_nec.common import utils -from networking_nec.nwa.agent import proxy_tenant as tenant_util -from networking_nec.nwa.common import constants as nwa_const -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.nwa.l2.rpc import nwa_l2_server_api -from networking_nec.nwa.l2.rpc import tenant_binding_api -from networking_nec.nwa.nwalib import data_utils - - -LOG = logging.getLogger(__name__) - -KEY_CREATE_TENANT_NW = 'CreateTenantNW' -WAIT_AGENT_NOTIFIER = 20 -# WAIT_AGENT_NOTIFIER = 1 - - -def check_vlan(network_id, nwa_data): - # dev_key = 'VLAN_' + network_id + '_.*_VlanID$' - # TFW, GDV: VLAN_' + network_id + '_.*_VlanID$ - # TLB: VLAN_LB_' + network_id + '_.*_VlanID$ - vlan_pat = re.compile(r'VLAN_.*' + network_id + '_.*_VlanID$') - matched = [k for k in nwa_data if vlan_pat.match(k)] - if matched: - LOG.debug("find device in network(ids=%s)", network_id) - return len(matched) - - -def count_device_id(device_id, nwa_data): - dev_pat = re.compile(r'DEV_' + device_id + '_') - matched = [k for k in nwa_data if dev_pat.match(k)] - if matched: - LOG.debug("found device with device_id=%s", device_id) - return len(matched) - - -def check_segment(network_id, res_name, nwa_data, dev_type): - dev_pat = re.compile(r'DEV_.*_' + network_id + '_' + res_name) - matched = [k for k in nwa_data - if dev_pat.match(k) and dev_type == nwa_data[k]] - if matched: - LOG.debug("find device in network(id=%(network_id)s)," - " resource_group_name=%(res_name)s, type=%(dev_type)s", - {'network_id': network_id, - 'res_name': res_name, - 'dev_type': dev_type}) - return len(matched) - - -def check_segment_gd(network_id, res_name, nwa_data): - return check_segment(network_id, res_name, nwa_data, - nwa_const.NWA_DEVICE_GDV) - - -def check_segment_tfw(network_id, res_name, nwa_data): - return check_segment(network_id, res_name, nwa_data, - nwa_const.NWA_DEVICE_TFW) - - -def get_resource_group_name(nwa_info, nwa_data, dev_type): - device_id = nwa_info['device']['id'] - network_id = nwa_info['network']['id'] - mac = nwa_info['port']['mac'] - - found_mac = None - found_dev_type = None - dev_prefix = 'DEV_%s_%s_' % (device_id, network_id) - for k, v in six.iteritems(nwa_data): - if not k.startswith(dev_prefix): - continue - if v == mac: - found_mac = k[len(dev_prefix):] - elif v == dev_type: - found_dev_type = k[len(dev_prefix):] - if found_mac and found_dev_type: - return found_dev_type - - -class AgentProxyL2(object): - - def __init__(self, agent_top, client, multi_dc=False): - self.nwa_tenant_rpc = tenant_binding_api.TenantBindingServerRpcApi( - topics.PLUGIN) - self.nwa_l2_rpc = nwa_l2_server_api.NwaL2ServerRpcApi(topics.PLUGIN) - self.agent_top = agent_top - self.client = client - self.multi_dc = multi_dc - - @property - def proxy_tenant(self): - return self.agent_top.proxy_tenant - - @utils.log_method_return_value - @helpers.log_method_call - def _create_tenant_nw(self, context, **kwargs): - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - - # get resource group name for NWA TenantNW. - resource_group_name = nwa_info['resource_group_name_nw'] - nwa_data = kwargs.get('nwa_data') - - if KEY_CREATE_TENANT_NW not in nwa_data: - LOG.debug("nwa_tenant_id=%(nwa_tenant_id)s, " - "resource_group_name_nw=%(resource_group_name)s", - {'nwa_tenant_id': nwa_tenant_id, - 'resource_group_name': resource_group_name}) - rcode, body = self.client.l2.create_tenant_nw( - nwa_tenant_id, - resource_group_name - ) - - if rcode == 200 and body['status'] == 'SUCCEED': - LOG.debug("CreateTenantNW succeed.") - nwa_data[KEY_CREATE_TENANT_NW] = True - return nwa_data - else: - LOG.error(_LE("CreateTenantNW Failed.")) - raise nwa_exc.AgentProxyException(value=nwa_data) - - @utils.log_method_return_value - def _delete_tenant_nw(self, context, **kwargs): - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_data = kwargs.get('nwa_data') - - rcode, body = self.client.l2.delete_tenant_nw( - nwa_tenant_id, - ) - - if rcode == 200 and body['status'] == 'SUCCEED': - LOG.debug("DeleteTenantNW SUCCEED.") - nwa_data.pop(KEY_CREATE_TENANT_NW) - else: - LOG.error(_LE("DeleteTenantNW %s."), body['status']) - raise nwa_exc.AgentProxyException(value=nwa_data) - - return nwa_data - - @utils.log_method_return_value - def _create_vlan(self, context, **kwargs): - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - nwa_data = kwargs.get('nwa_data') - - network_id = nwa_info['network']['id'] - nw_vlan_key = data_utils.get_vlan_key(network_id) - if nw_vlan_key in nwa_data: - LOG.warning(_LW("aleady in vlan_key %s"), nw_vlan_key) - return nwa_data - - rcode, body = self.client.l2.create_vlan( - nwa_tenant_id, - nwa_info['subnet']['netaddr'], - nwa_info['subnet']['mask'], - nwa_info['network']['vlan_type'], - openstack_network_id=network_id - ) - - if rcode == 200 and body['status'] == 'SUCCEED': - # create vlan succeed. - LOG.debug("CreateVlan succeed.") - data_utils.set_network_data(nwa_data, network_id, nwa_info, - body['resultdata']['LogicalNWName']) - data_utils.set_vlan_data(nwa_data, network_id, - body['resultdata']['VlanID']) - else: - # create vlan failed. - LOG.error(_LE("CreateVlan Failed.")) - raise nwa_exc.AgentProxyException(value=nwa_data) - - return nwa_data - - @utils.log_method_return_value - def _delete_vlan(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - nwa_data = kwargs.get('nwa_data') - - vlan_type = nwa_info['network']['vlan_type'] - physical_network = nwa_info['physical_network'] - network_id = nwa_info['network']['id'] - - # delete vlan - rcode, body = self.client.l2.delete_vlan( - nwa_tenant_id, - data_utils.get_vlan_logical_name(nwa_data, network_id), - vlan_type - ) - - if rcode == 200 and body['status'] == 'SUCCEED': - LOG.debug("DeleteVlan SUCCEED.") - - data_utils.strip_network_data(nwa_data, network_id) - data_utils.strip_vlan_data(nwa_data, network_id) - - self.nwa_l2_rpc.release_dynamic_segment_from_agent( - context, physical_network, - network_id - ) - - else: - LOG.debug("DeleteVlan FAILED.") - self.proxy_tenant.update_tenant_binding( - context, tenant_id, nwa_tenant_id, nwa_data - ) - raise nwa_exc.AgentProxyException(value=nwa_data) - - return nwa_data - - def _ensure_l2_network(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - network_id = nwa_info['network']['id'] - - LOG.debug("tenant_id=%(tenant_id)s, network_id=%(network_id)s, " - "device_owner=%(device_owner)s", - {'tenant_id': tenant_id, - 'network_id': network_id, - 'device_owner': nwa_info['device']['owner']}) - - nwa_data = self.nwa_tenant_rpc.get_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id - ) - - # create tenant - if not nwa_data: - nwa_data = self.proxy_tenant.create_tenant(context, **kwargs) - if not self.proxy_tenant.update_tenant_binding( - context, tenant_id, nwa_tenant_id, - nwa_data, nwa_created=True): - return - - # create tenant nw - if KEY_CREATE_TENANT_NW not in nwa_data: - # raise AgentProxyException if fail - self._create_tenant_nw(context, nwa_data=nwa_data, **kwargs) - - # create vlan - nw_vlan_key = data_utils.get_network_key(network_id) - if nw_vlan_key not in nwa_data: - # raise AgentProxyException if fail - self._create_vlan(context, nwa_data=nwa_data, **kwargs) - - return nwa_data - - @helpers.log_method_call - @tenant_util.catch_exception_and_update_tenant_binding - def ensure_l2_network(self, context, **kwargs): - return self._ensure_l2_network(context, **kwargs) - - @helpers.log_method_call - @tenant_util.catch_exception_and_update_tenant_binding - def create_general_dev(self, context, **kwargs): - """Create GeneralDev wrapper. - - @param context: contains user information. - @param kwargs: - @return: dict of status and msg. - """ - - nwa_data = self._ensure_l2_network(context, **kwargs) - if not nwa_data: - return - - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - - network_id = nwa_info['network']['id'] - resource_group_name = nwa_info['resource_group_name'] - - # create general dev - if not check_segment_gd(network_id, resource_group_name, nwa_data): - if self.multi_dc: - sync_vlan_id = self._create_connect_port - else: - sync_vlan_id = self._create_general_dev - # raise AgentProxyException if fail - nwa_data = sync_vlan_id(context, nwa_data=nwa_data, **kwargs) - else: - ret_val = self._create_general_dev_data( - nwa_data=nwa_data, **kwargs) - if ret_val: - nwa_data = ret_val - # agent waits for notifier issue for libviert. - time.sleep(WAIT_AGENT_NOTIFIER) - # create general dev end - - ret = self.proxy_tenant.update_tenant_binding( - context, tenant_id, nwa_tenant_id, nwa_data, - nwa_created=False - ) - - segment = { - api.PHYSICAL_NETWORK: nwa_info['physical_network'], - api.NETWORK_TYPE: plugin_const.TYPE_VLAN, - api.SEGMENTATION_ID: data_utils.get_vp_net_vlan_id( - nwa_data, network_id, resource_group_name, - nwa_const.NWA_DEVICE_GDV) - } - - self.nwa_l2_rpc.update_port_state_with_notifier( - context, nwa_info['device']['id'], self.agent_top.agent_id, - nwa_info['port']['id'], segment, network_id - ) - - return ret - - def _append_device_for_gdv(self, nwa_info, nwa_data): - network_id = nwa_info['network']['id'] - device_id = nwa_info['device']['id'] - resource_group_name = nwa_info['resource_group_name'] - - data_utils.set_gdv_device_data(nwa_data, device_id, nwa_info) - data_utils.set_gdv_interface_data(nwa_data, device_id, network_id, - resource_group_name, nwa_info) - - return nwa_data - - @utils.log_method_return_value - def _create_general_dev_data(self, **kwargs): - nwa_info = kwargs.get('nwa_info') - nwa_data = kwargs.get('nwa_data') - - self._append_device_for_gdv(nwa_info, nwa_data) - - return nwa_data - - @utils.log_method_return_value - @helpers.log_method_call - def _create_general_dev(self, context, **kwargs): - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - nwa_data = kwargs.get('nwa_data') - - network_id = nwa_info['network']['id'] - resource_group_name = nwa_info['resource_group_name'] - - port_type = None - - rcode, body = self.client.l2.create_general_dev( - nwa_tenant_id, - resource_group_name, - data_utils.get_vlan_logical_name(nwa_data, network_id), - port_type=port_type - ) - - if rcode == 200 and body['status'] == 'SUCCEED': - LOG.debug("CreateGeneralDev SUCCEED") - - vlan_key = data_utils.get_vlan_key(network_id) - if vlan_key not in nwa_data: - LOG.error(_LE("not create vlan.")) - raise nwa_exc.AgentProxyException(value=nwa_data) - - vlan_id = data_utils.get_vlan_id(network_id, nwa_data, - body['resultdata']) - data_utils.set_vp_net_data(nwa_data, network_id, - resource_group_name, - nwa_const.NWA_DEVICE_GDV, - vlan_id) - - self._append_device_for_gdv(nwa_info, nwa_data) - else: - LOG.debug("CreateGeneralDev %s", body['status']) - raise nwa_exc.AgentProxyException(value=nwa_data) - - return nwa_data - - @helpers.log_method_call - @tenant_util.catch_exception_and_update_tenant_binding - def delete_general_dev(self, context, **kwargs): - """Delete GeneralDev. - - @param context: contains user information. - @param kwargs: - @return: dict of status and msg. - """ - - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - network_id = nwa_info['network']['id'] - resource_group_name = nwa_info['resource_group_name'] - - nwa_data = self.nwa_tenant_rpc.get_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id - ) - - # rpc return empty. - if not nwa_data: - LOG.error(_LE('nwa_tenant_binding not found.' - ' tenant_id=%(tenant_id)s,' - ' nwa_tenant_id=%(nwa_tenant_id)s'), - {'tenant_id': tenant_id, - 'nwa_tenant_id': nwa_tenant_id}) - return {'result': 'FAILED'} - - if not resource_group_name: - resource_group_name = get_resource_group_name( - nwa_info, nwa_data, nwa_const.NWA_DEVICE_GDV) - if not resource_group_name: - LOG.debug('skip delete_general_dev.' - ' No nwa device is associated with' - ' the port %s', nwa_info.get('port')) - return {'result': 'FAILED'} - nwa_info['resource_group_name'] = resource_group_name - - gd_count = check_segment_gd(network_id, resource_group_name, nwa_data) - - if 1 < gd_count: - nwa_data = self._delete_general_dev_data( - nwa_data=nwa_data, **kwargs) - self._delete_general_dev_segment(context, nwa_data, nwa_info) - raise nwa_exc.AgentProxyException(value=nwa_data) - - if self.multi_dc: - sync_vlan_id = self._delete_connect_port - else: - sync_vlan_id = self._delete_general_dev - # raise AgentProxyException if fail - nwa_data = sync_vlan_id(context, nwa_data=nwa_data, **kwargs) - # delete general dev end - - return self._terminate_l2_network(context, nwa_data, **kwargs) - - @helpers.log_method_call - @tenant_util.catch_exception_and_update_tenant_binding - def terminate_l2_network(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_data = self.nwa_tenant_rpc.get_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id) - return self._terminate_l2_network(context, nwa_data, **kwargs) - - def _terminate_l2_network(self, context, nwa_data, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - network_id = nwa_info['network']['id'] - - # port check on segment. - if check_vlan(network_id, nwa_data): - raise nwa_exc.AgentProxyException(value=nwa_data) - - # delete vlan - # raise AgentProxyException if fail - nwa_data = self._delete_vlan(context, nwa_data=nwa_data, **kwargs) - # delete vlan end. - - # tenant network check. - for k in nwa_data: - if re.match('NW_.*', k): - raise nwa_exc.AgentProxyException(value=nwa_data) - - LOG.info(_LI("delete_tenant_nw")) - # raise AgentProxyException if fail - nwa_data = self._delete_tenant_nw(context, nwa_data=nwa_data, **kwargs) - - # delete tenant - LOG.info(_LI("delete_tenant")) - nwa_data = self.proxy_tenant.delete_tenant( - context, - nwa_data=nwa_data, - **kwargs - ) - # delete tenant end. - - # delete nwa_tenant binding. - LOG.info(_LI("delete_nwa_tenant_binding")) - return self.nwa_tenant_rpc.delete_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id - ) - - @utils.log_method_return_value - def _delete_general_dev_data(self, **kwargs): - nwa_info = kwargs.get('nwa_info') - nwa_data = kwargs.get('nwa_data') - - device_id = nwa_info['device']['id'] - network_id = nwa_info['network']['id'] - resource_group_name = nwa_info['resource_group_name'] - - dev_key = data_utils.get_device_key(device_id) - if dev_key in nwa_data: - data_utils.strip_interface_data( - nwa_data, device_id, network_id, resource_group_name) - if count_device_id(device_id, nwa_data) == 1: - data_utils.strip_device_data(nwa_data, device_id) - - if not check_segment_gd(network_id, resource_group_name, nwa_data): - data_utils.strip_vp_net_data(nwa_data, network_id, - resource_group_name, - nwa_const.NWA_DEVICE_GDV) - - return nwa_data - - def _delete_general_dev_segment(self, context, nwa_data, nwa_info): - network_id = nwa_info['network']['id'] - physical_network = nwa_info['physical_network'] - resource_group_name = nwa_info['resource_group_name'] - if not check_segment_gd(network_id, resource_group_name, nwa_data): - self.nwa_l2_rpc.release_dynamic_segment_from_agent( - context, physical_network, network_id - ) - - @utils.log_method_return_value - @helpers.log_method_call - def _delete_general_dev(self, context, **kwargs): - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - nwa_data = kwargs.get('nwa_data') - - network_id = nwa_info['network']['id'] - resource_group = nwa_info['resource_group_name'] - - # delete general dev - logical_name = data_utils.get_vlan_logical_name(nwa_data, network_id) - rcode, body = self.client.l2.delete_general_dev( - nwa_tenant_id, - resource_group, - logical_name, - ) - if rcode != 200: - LOG.debug("DeleteGeneralDev Error: invalid response. rcode = %d", - rcode) - # error port send to plugin - raise nwa_exc.AgentProxyException(value=nwa_data) - - if body['status'] == 'SUCCEED': - LOG.debug("DeleteGeneralDev SUCCEED") - nwa_data = self._delete_general_dev_data(**kwargs) - self._delete_general_dev_segment(context, nwa_data, nwa_info) - else: - LOG.debug("DeleteGeneralDev %s", body['status']) - raise nwa_exc.AgentProxyException(value=nwa_data) - # delete general dev end - - return nwa_data - - @utils.log_method_return_value - @helpers.log_method_call - def create_connect_port(self, context, **kwargs): - nwa_info = kwargs['nwa_info'] - nwa_data = kwargs['nwa_data'] - network_id = nwa_info['network']['id'] - vlan_id = nwa_info['network']['vlan_id'] - resource_group_name = nwa_info['resource_group_name'] - rcode, body = self.client.l2.create_connect_port( - kwargs.get('nwa_tenant_id'), - resource_group_name, - data_utils.get_vlan_logical_name(nwa_data, network_id), - nwa_info['network']['vlan_type'], - vlan_id - ) - if rcode == 200 and body['status'] == 'SUCCEED': - LOG.debug("CreateConnectPort SUCCEED") - return body - - @utils.log_method_return_value - @helpers.log_method_call - def _create_connect_port(self, context, **kwargs): - body = self.create_connect_port(context, **kwargs) - if body: - nwa_data = kwargs['nwa_data'] - nwa_info = kwargs['nwa_info'] - network_id = nwa_info['network']['id'] - vlan_id = nwa_info['network']['vlan_id'] - resource_group_name = nwa_info['resource_group_name'] - vlan_key = data_utils.get_vlan_key(network_id) - if vlan_key not in nwa_data: - LOG.error(_LE("not create vlan.")) - raise nwa_exc.AgentProxyException(value=nwa_data) - data_utils.set_vp_net_data(nwa_data, network_id, - resource_group_name, - nwa_const.NWA_DEVICE_GDV, - vlan_id) - self._append_device_for_gdv(nwa_info, nwa_data) - else: - LOG.debug("CreateConnectPort %s", body['status']) - raise nwa_exc.AgentProxyException(value=nwa_data) - return nwa_data - - @utils.log_method_return_value - @helpers.log_method_call - def delete_connect_port(self, context, **kwargs): - nwa_info = kwargs['nwa_info'] - nwa_data = kwargs['nwa_data'] - network_id = nwa_info['network']['id'] - vlan_id = nwa_info['network']['vlan_id'] - resource_group_name = nwa_info['resource_group_name'] - rcode, body = self.client.l2.delete_connect_port( - kwargs['nwa_tenant_id'], - resource_group_name, - data_utils.get_vlan_logical_name(nwa_data, network_id), - nwa_info['network']['vlan_type'], - vlan_id - ) - if rcode == 200 and body['status'] == 'SUCCEED': - LOG.debug("DeleteConnectPort SUCCEED") - return body - - @utils.log_method_return_value - @helpers.log_method_call - def _delete_connect_port(self, context, **kwargs): - body = self.delete_connect_port(context, **kwargs) - if body: - nwa_data = self._delete_general_dev_data(**kwargs) - self._delete_general_dev_segment(context, nwa_data, - kwargs['nwa_info']) - else: - LOG.debug("DeleteConnectPort %s", body['status']) - raise nwa_exc.AgentProxyException(value=kwargs['nwa_data']) - return nwa_data diff --git a/networking_nec/nwa/agent/proxy_l3.py b/networking_nec/nwa/agent/proxy_l3.py deleted file mode 100644 index 95d7114..0000000 --- a/networking_nec/nwa/agent/proxy_l3.py +++ /dev/null @@ -1,440 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import re - -from neutron.common import topics -from neutron.plugins.common import constants as n_constants -from neutron.plugins.ml2 import driver_api as api -from neutron_lib import constants -from oslo_log import helpers -from oslo_log import log as logging - -from networking_nec._i18n import _LE, _LW -from networking_nec.common import utils -from networking_nec.nwa.agent import proxy_l2 as l2 -from networking_nec.nwa.agent import proxy_tenant as tenant_util -from networking_nec.nwa.common import constants as nwa_const -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.nwa.l2.rpc import nwa_l2_server_api -from networking_nec.nwa.l2.rpc import tenant_binding_api -from networking_nec.nwa.l3.rpc import nwa_l3_server_api -from networking_nec.nwa.nwalib import data_utils - - -LOG = logging.getLogger(__name__) - - -# pylint: disable=too-many-instance-attributes -class AgentProxyL3(object): - - def __init__(self, agent_top, client, multi_dc=False, - tenant_fw_create_hook=None, - tenant_fw_delete_hook=None, - tenant_fw_connect_hook=None, - tenant_fw_disconnect_hook=None): - self.nwa_tenant_rpc = tenant_binding_api.TenantBindingServerRpcApi( - topics.PLUGIN) - self.nwa_l2_rpc = nwa_l2_server_api.NwaL2ServerRpcApi(topics.PLUGIN) - self.nwa_l3_rpc = nwa_l3_server_api.NwaL3ServerRpcApi(topics.L3PLUGIN) - self.agent_top = agent_top - self.client = client - self.multi_dc = multi_dc - self.tenant_fw_create_hook = tenant_fw_create_hook - self.tenant_fw_delete_hook = tenant_fw_delete_hook - self.tenant_fw_connect_hook = tenant_fw_connect_hook - self.tenant_fw_disconnect_hook = tenant_fw_disconnect_hook - - @property - def proxy_tenant(self): - return self.agent_top.proxy_tenant - - @property - def proxy_l2(self): - return self.agent_top.proxy_l2 - - @helpers.log_method_call - @tenant_util.catch_exception_and_update_tenant_binding - def create_tenant_fw(self, context, **kwargs): - nwa_data = self.proxy_l2.ensure_l2_network(context, **kwargs) - device_id = kwargs['nwa_info']['device']['id'] - network_id = kwargs['nwa_info']['network']['id'] - dev_key = data_utils.get_device_key(device_id) - net_key = data_utils.get_device_net_key(device_id, network_id) - if dev_key not in nwa_data: - nwa_data = self._create_tenant_fw(nwa_data, context, **kwargs) - elif net_key not in nwa_data: - nwa_data = self._update_tenant_fw( - context, connect='connect', nwa_data=nwa_data, **kwargs) - else: - LOG.warning(_LW("unknown device.")) - - if not nwa_data: - raise nwa_exc.AgentProxyException(value=kwargs['nwa_data']) - ret = self.proxy_tenant.update_tenant_binding( - context, - kwargs['tenant_id'], kwargs['nwa_tenant_id'], - nwa_data - ) - resource_group_name_nw = kwargs['nwa_info']['resource_group_name_nw'] - vlan_id = data_utils.get_vp_net_vlan_id(nwa_data, network_id, - resource_group_name_nw, - nwa_const.NWA_DEVICE_TFW) - - self.nwa_l2_rpc.update_port_state_with_notifier( - context, - device_id, - self.agent_top.agent_id, - kwargs['nwa_info']['port']['id'], - { - api.PHYSICAL_NETWORK: kwargs['nwa_info']['physical_network'], - api.NETWORK_TYPE: n_constants.TYPE_VLAN, - api.SEGMENTATION_ID: vlan_id - }, - network_id - ) - return ret - - @utils.log_method_return_value - def _create_tenant_fw(self, nwa_data, context, **kwargs): - if self.multi_dc: - self.proxy_l2.create_connect_port(context, nwa_data=nwa_data, - **kwargs) - device_id = kwargs['nwa_info']['device']['id'] - network_id = kwargs['nwa_info']['network']['id'] - rcode, body = self.client.l3.create_tenant_fw( - kwargs['nwa_tenant_id'], - kwargs['nwa_info']['resource_group_name'], - kwargs['nwa_info']['port']['ip'], - data_utils.get_vlan_logical_name(nwa_data, network_id), - kwargs['nwa_info']['network']['vlan_type'] - ) - if rcode != 200 or body['status'] != 'SUCCEED': - return None - - LOG.debug("CreateTenantFW SUCCEED.") - - tfw_name = body['resultdata']['TenantFWName'] - resource_group_name_nw = kwargs['nwa_info']['resource_group_name_nw'] - - data_utils.set_tfw_device_data(nwa_data, device_id, - tfw_name, kwargs['nwa_info']) - data_utils.set_tfw_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw, - tfw_name, kwargs['nwa_info']) - vlan_id = data_utils.get_vlan_id(network_id, nwa_data, - body['resultdata']) - data_utils.set_vp_net_data(nwa_data, network_id, - resource_group_name_nw, - nwa_const.NWA_DEVICE_TFW, - vlan_id) - - if self.tenant_fw_create_hook: - self.tenant_fw_create_hook(context, tfw_name, **kwargs) - return nwa_data - - @utils.log_method_return_value - def _update_tenant_fw(self, context, **kwargs): - connect = kwargs.get('connect') - try: - if connect == 'connect': - self._update_tenant_fw_connect(context, **kwargs) - else: # connect == 'disconnect' - self._update_tenant_fw_disconnect(context, **kwargs) - except nwa_exc.AgentProxyException: - return - return kwargs['nwa_data'] - - def _update_tenant_fw_connect(self, context, **kwargs): - if self.multi_dc: - self.proxy_l2.create_connect_port(context, **kwargs) - nwa_data = kwargs.get('nwa_data') - device_id = kwargs['nwa_info']['device']['id'] - network_id = kwargs['nwa_info']['network']['id'] - - rcode, body = self.client.l3.update_tenant_fw( - kwargs['nwa_tenant_id'], - data_utils.get_tfw_device_name(nwa_data, device_id), - kwargs['nwa_info']['port']['ip'], - data_utils.get_vlan_logical_name(nwa_data, network_id), - kwargs['nwa_info']['network']['vlan_type'], - connect='connect') - - if rcode != 200 or body['status'] != 'SUCCEED': - raise nwa_exc.AgentProxyException(value=None) - - LOG.debug("UpdateTenantFW succeed.") - resource_group_name_nw = kwargs['nwa_info']['resource_group_name_nw'] - tfw_name = body['resultdata']['TenantFWName'] - - data_utils.set_tfw_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw, - tfw_name, kwargs['nwa_info']) - vlan_id = data_utils.get_vlan_id(network_id, nwa_data, - body['resultdata']) - data_utils.set_vp_net_data(nwa_data, network_id, - resource_group_name_nw, - nwa_const.NWA_DEVICE_TFW, - vlan_id) - - if self.tenant_fw_connect_hook: - self.tenant_fw_connect_hook(context, tfw_name, **kwargs) - return nwa_data - - @helpers.log_method_call - def _update_tenant_fw_disconnect(self, context, **kwargs): - """Update Tenant FW - - @param context: contains user information. - @param kwargs: - @return: nwa_data - @raise AgentProxyException - """ - if self.multi_dc: - self.proxy_l2.delete_connect_port(context, **kwargs) - nwa_data = kwargs.get('nwa_data') - device_id = kwargs['nwa_info']['device']['id'] - network_id = kwargs['nwa_info']['network']['id'] - device_name = data_utils.get_tfw_device_name(nwa_data, device_id) - - if self.tenant_fw_disconnect_hook: - self.tenant_fw_disconnect_hook(context, device_name, **kwargs) - - rcode, body = self.client.l3.update_tenant_fw( - kwargs['nwa_tenant_id'], - device_name, - kwargs['nwa_info']['port']['ip'], - data_utils.get_vlan_logical_name(nwa_data, network_id), - kwargs['nwa_info']['network']['vlan_type'], - connect='disconnect' - ) - if rcode != 200 or body['status'] != 'SUCCEED': - LOG.error(_LE("UpdateTenantFW(disconnect) FAILED.")) - info = {'status': 'FAILED', - 'msg': 'UpdateTenantFW(disconnect) FAILED.'} - raise nwa_exc.AgentProxyException(value=info) - - LOG.debug("UpdateTenantFW(disconnect) SUCCEED.") - resource_group_name_nw = kwargs['nwa_info']['resource_group_name_nw'] - - data_utils.strip_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw) - data_utils.strip_tfw_data_if_exist(nwa_data, device_id, network_id, - resource_group_name_nw) - - if not l2.check_segment_tfw(network_id, resource_group_name_nw, - nwa_data): - data_utils.strip_vp_net_data(nwa_data, network_id, - resource_group_name_nw, - nwa_const.NWA_DEVICE_TFW) - return nwa_data - - @helpers.log_method_call - def _delete_tenant_fw(self, context, **kwargs): - """Delete Tenant FW - - @param context: contains user information. - @param kwargs: nwa_tenant_id, nwa_tenant_id, nwa_info, nwa_data - @return: resutl(succeed = True, other = False), data(nwa_data or None) - """ - if self.multi_dc: - self.proxy_l2.delete_connect_port(context, **kwargs) - nwa_data = kwargs.get('nwa_data') - nwa_info = kwargs['nwa_info'] - - network_id = nwa_info['network']['id'] - device_id = nwa_info['device']['id'] - - device_name = data_utils.get_tfw_device_name(nwa_data, device_id) - if self.tenant_fw_delete_hook: - self.tenant_fw_delete_hook(context, device_name, **kwargs) - - rcode, body = self.client.l3.delete_tenant_fw( - kwargs['nwa_tenant_id'], - device_name, - 'TFW' - ) - if rcode != 200 or body['status'] != 'SUCCEED': - msg = _LE("DeleteTenantFW %s."), body['status'] - LOG.error(msg) - raise nwa_exc.AgentProxyException(value=nwa_data) - - LOG.debug("DeleteTenantFW SUCCEED.") - - resource_group_name_nw = nwa_info['resource_group_name_nw'] - # delete recode - data_utils.strip_device_data(nwa_data, device_id) - data_utils.strip_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw) - data_utils.strip_tfw_data_if_exist(nwa_data, device_id, network_id, - resource_group_name_nw) - - if not l2.check_segment_tfw(network_id, resource_group_name_nw, - nwa_data): - data_utils.strip_vp_net_data(nwa_data, network_id, - resource_group_name_nw, - nwa_const.NWA_DEVICE_TFW) - return nwa_data - - @utils.log_method_return_value - @helpers.log_method_call - @tenant_util.catch_exception_and_update_tenant_binding - def delete_tenant_fw(self, context, **kwargs): - """Delete Tenant FireWall. - - @param context: contains user information. - @param kwargs: tenant_id, nwa_tenant_id, nwa_info - @return: dict of status and msg. - """ - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_info = kwargs.get('nwa_info') - - network_id = nwa_info['network']['id'] - device_id = nwa_info['device']['id'] - - nwa_data = self.nwa_tenant_rpc.get_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id - ) - - # check tfw interface - tfwif = "^DEV_" + device_id + '_.*_TenantFWName$' - count = sum(not re.match(tfwif, k) is None for k in nwa_data.keys()) - - if 1 < count: - ret_val = self._update_tenant_fw( - context, - nwa_data=nwa_data, - connect='disconnect', - **kwargs - ) - if not ret_val: - LOG.error(_LE("UpdateTenantFW disconnect FAILED")) - tfw_sgif = re.compile("^DEV_.*_" + network_id + '_TYPE$') - sgif_count = len([k for k in nwa_data if tfw_sgif.match(k)]) - if sgif_count: - raise nwa_exc.AgentProxyException(value=nwa_data) - nwa_data = ret_val - elif count == 1: - # raise AgentProxyException if fail - nwa_data = self._delete_tenant_fw( - context, nwa_data=nwa_data, **kwargs) - else: - LOG.error(_LE("count miss match")) - raise nwa_exc.AgentProxyException(value=nwa_data) - - return self.proxy_l2._terminate_l2_network(context, - nwa_data, **kwargs) - - @helpers.log_method_call - def setting_nat(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - fip_id = kwargs['floating']['id'] - - nwa_data = self.nwa_tenant_rpc.get_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id) - - try: - ret_val = self._setting_nat(context, nwa_data=nwa_data, **kwargs) - except nwa_exc.AgentProxyException: - self.nwa_l3_rpc.update_floatingip_status( - context, fip_id, constants.FLOATINGIP_STATUS_ERROR) - return - - self.nwa_l3_rpc.update_floatingip_status( - context, fip_id, constants.FLOATINGIP_STATUS_ACTIVE) - return self.proxy_tenant.update_tenant_binding( - context, tenant_id, nwa_tenant_id, ret_val) - - @helpers.log_method_call - def _setting_nat(self, context, **kwargs): - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_data = kwargs.get('nwa_data') - floating = kwargs.get('floating') - - # new code.(neet ut) - nat_key = 'NAT_' + floating['id'] - if nat_key in nwa_data: - LOG.debug('already in use NAT key =%s', nat_key) - raise nwa_exc.AgentProxyException(value=None) - - vlan_logical_name = data_utils.get_vlan_logical_name( - nwa_data, floating['floating_network_id']) - dev_name = data_utils.get_tfw_device_name(nwa_data, - floating['device_id']) - - # setting nat - rcode, body = self.client.l3.setting_nat( - nwa_tenant_id, - vlan_logical_name, 'PublicVLAN', - floating['fixed_ip_address'], - floating['floating_ip_address'], dev_name, data=floating - ) - - if rcode != 200 or body['status'] != 'SUCCEED': - LOG.debug("SettingNat Error: invalid responce." - " rcode=%d status=%s" % (rcode, body)) - raise nwa_exc.AgentProxyException(value=None) - else: - LOG.debug("SettingNat SUCCEED") - data_utils.set_floatingip_data(nwa_data, floating) - return nwa_data - - @helpers.log_method_call - def delete_nat(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - fip_id = kwargs['floating']['id'] - - nwa_data = self.nwa_tenant_rpc.get_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id) - - try: - ret_val = self._delete_nat(context, nwa_data=nwa_data, **kwargs) - except nwa_exc.AgentProxyException: - self.nwa_l3_rpc.update_floatingip_status( - context, fip_id, constants.FLOATINGIP_STATUS_ERROR) - return - - self.nwa_l3_rpc.update_floatingip_status( - context, fip_id, constants.FLOATINGIP_STATUS_DOWN) - return self.proxy_tenant.update_tenant_binding( - context, tenant_id, nwa_tenant_id, ret_val) - - @helpers.log_method_call - def _delete_nat(self, context, **kwargs): - nwa_data = kwargs.get('nwa_data') - floating = kwargs.get('floating') - - vlan_logical_name = data_utils.get_vlan_logical_name( - nwa_data, floating['floating_network_id']) - dev_name = data_utils.get_tfw_device_name(nwa_data, - floating['device_id']) - - # setting nat - rcode, body = self.client.l3.delete_nat( - kwargs.get('nwa_tenant_id'), - vlan_logical_name, 'PublicVLAN', - floating['fixed_ip_address'], - floating['floating_ip_address'], dev_name, data=floating) - - if rcode != 200 or body['status'] != 'SUCCEED': - LOG.debug("DeleteNat Error: invalid responce." - " rcode=%d status=%s" % (rcode, body)) - raise nwa_exc.AgentProxyException(value=None) - else: - LOG.debug("DeleteNat SUCCEED") - data_utils.strip_floatingip_data(nwa_data, floating) - return nwa_data diff --git a/networking_nec/nwa/agent/proxy_tenant.py b/networking_nec/nwa/agent/proxy_tenant.py deleted file mode 100644 index a916107..0000000 --- a/networking_nec/nwa/agent/proxy_tenant.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.common import topics -from oslo_log import log as logging -from oslo_serialization import jsonutils - -from networking_nec._i18n import _LW -from networking_nec.common import utils -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.nwa.l2.rpc import tenant_binding_api - -LOG = logging.getLogger(__name__) - - -def catch_exception_and_update_tenant_binding(method): - - def wrapper(obj, context, **kwargs): - try: - return method(obj, context, **kwargs) - except nwa_exc.AgentProxyException as e: - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_data = e.value - return obj.proxy_tenant.update_tenant_binding( - context, tenant_id, nwa_tenant_id, nwa_data) - - return wrapper - - -class AgentProxyTenant(object): - - def __init__(self, agent_top, client): - self.agent_top = agent_top - self.client = client - self.nwa_tenant_rpc = tenant_binding_api.TenantBindingServerRpcApi( - topics.PLUGIN) - - @utils.log_method_return_value - def create_tenant(self, context, **kwargs): - """create tenant - - @param context: contains user information. - @param kwargs: nwa_tenant_id - @return: succeed - dict of status, and information. - """ - nwa_tenant_id = kwargs.get('nwa_tenant_id') - - status_code, __data = self.client.tenant.create_tenant(nwa_tenant_id) - if status_code in (200, 500): # success(200), already exists(500) - return { - 'CreateTenant': True, - 'NWA_tenant_id': nwa_tenant_id - } - raise nwa_exc.AgentProxyException(value=status_code) - - @utils.log_method_return_value - def delete_tenant(self, context, **kwargs): - """delete tenant. - - @param context: contains user information. - @param kwargs: nwa_tenant_id - @return: result(succeed = (True, dict(empty) other = False, None) - """ - nwa_tenant_id = kwargs.get('nwa_tenant_id') - rcode, body = self.client.tenant.delete_tenant(nwa_tenant_id) - if rcode != 200: - LOG.warning(_LW('unexpected status code %s in delete_tenant'), - rcode) - return body - - @utils.log_method_return_value - def update_tenant_binding( - self, context, tenant_id, nwa_tenant_id, - nwa_data, nwa_created=False - ): - """Update Tenant Binding on NECNWAL2Plugin. - - @param context:contains user information. - @param tenant_id: Openstack Tenant UUID - @param nwa_tenant_id: NWA Tenand ID - @param nwa_data: nwa_tenant_binding data. - @param nwa_created: flag of operation. True = Create, False = Update - @return: dict of status and msg. - """ - LOG.debug("nwa_data=%s", jsonutils.dumps( - nwa_data, - indent=4, - sort_keys=True - )) - if nwa_created: - return self.nwa_tenant_rpc.add_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id, nwa_data - ) - - return self.nwa_tenant_rpc.set_nwa_tenant_binding( - context, tenant_id, nwa_tenant_id, nwa_data - ) diff --git a/networking_nec/nwa/agent/server_manager.py b/networking_nec/nwa/agent/server_manager.py deleted file mode 100644 index 6b0e1f0..0000000 --- a/networking_nec/nwa/agent/server_manager.py +++ /dev/null @@ -1,130 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import eventlet -from neutron.common import rpc as n_rpc -from oslo_config import cfg -from oslo_log import log as logging -from oslo_messaging.rpc.server import get_rpc_server -from oslo_messaging.target import Target - -from networking_nec._i18n import _LW, _LI, _LE -from networking_nec.nwa.common import constants as nwa_const - -LOG = logging.getLogger(__name__) - - -class ServerManager(object): - """Implementation of nwa_agent_callback.NwaAgentRpcCallback.""" - - rpc_servers = {} - - def __init__(self, topic, agent_top, size=1000): - super(ServerManager, self).__init__() - self.topic = topic - self.agent_top = agent_top - self.greenpool_size = size - self.greenpool = eventlet.greenpool.GreenPool(self.greenpool_size) - - def get_rpc_server_topics(self): - return [v['topic'] for v in self.rpc_servers.values()] - - def get_rpc_server_tenant_ids(self): - return [{'tenant_id': tid} for tid in self.rpc_servers] - - def create_tenant_rpc_server(self, tid): - """create_ blocking rpc server - - @param tid: openstack tenant id - """ - ret = {} - - if tid in self.rpc_servers: - LOG.warning( - _LW("already in message queue and server. queue=%s"), - self.rpc_servers[tid]['topic'] - ) - return {'result': 'FAILED'} - - topic = "%s-%s" % (self.topic, tid) - - target = Target( - topic=topic, server=cfg.CONF.host, fanout=False) - - assert n_rpc.TRANSPORT is not None - serializer = n_rpc.RequestContextSerializer(None) - - server = get_rpc_server( - n_rpc.TRANSPORT, target, - self.agent_top.endpoints, - 'blocking', serializer - ) - - LOG.debug("RPCServer create: topic=%s", topic) - if self.greenpool.free() < 1: - self.greenpool_size += nwa_const.NWA_GREENPOOL_ADD_SIZE - self.greenpool.resize(self.greenpool_size) - LOG.info(_LI('RPCServer greenpool resize %s'), self.greenpool_size) - - def server_start(): - while True: - try: - LOG.debug('RPCServer thread %d start %s', - (self.greenpool.running(), server)) - server.start() - LOG.debug('RPCServer thread end %s', server) - break - except Exception as e: - LOG.exception(_LE('RPCServer thread start failed: %s'), e) - - self.rpc_servers[tid] = { - 'thread': self.greenpool.spawn(server_start), - 'server': server, - 'topic': topic - } - eventlet.sleep(0) - LOG.info(_LI('RPCServer started: %(topic)s server=%(server)s'), - {'topic': topic, 'server': server}) - - ret['result'] = 'SUCCESS' - ret['tenant_id'] = tid - ret['topic'] = topic - - return ret - - def delete_tenant_rpc_server(self, tid): - if tid not in self.rpc_servers: - LOG.warning(_LW("rpc server not found. tid=%s"), tid) - return {'result': 'FAILED'} - - LOG.debug('RPCServer delete: stop %s', tid) - self.rpc_servers[tid]['server'].stop() - - LOG.debug('RPCServer delete: wait %s', tid) - self.rpc_servers[tid]['server'].wait() - - LOG.debug('RPCServer delete: pop %s', tid) - self.rpc_servers.pop(tid) - - LOG.debug('RPCServer delete: sleep %s', tid) - eventlet.sleep(0) - - ret = { - 'result': 'SUCCESS', - 'tenant_id': tid - } - - LOG.debug("RPCServer deleted: %s", ret) - - return ret diff --git a/networking_nec/nwa/common/__init__.py b/networking_nec/nwa/common/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/common/config.py b/networking_nec/nwa/common/config.py deleted file mode 100644 index f313a74..0000000 --- a/networking_nec/nwa/common/config.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.agent.common import config -from oslo_config import cfg - -from networking_nec._i18n import _ - -agent_opts = [ - cfg.IntOpt('polling_interval', default=2, - help=_("The number of seconds the agent will wait between " - "polling for local device changes.")), -] - -cfg.CONF.register_opts(agent_opts, "AGENT") -config.register_agent_state_opts_helper(cfg.CONF) - -# nwa.ini -NWA_opts = [ - cfg.StrOpt('server_url', - help=_("URL for NWA REST API.")), - cfg.StrOpt('access_key_id', - help=_("Access ID for NWA REST API.")), - cfg.StrOpt('secret_access_key', - help=_("Secret key for NWA REST API.")), - cfg.StrOpt('resource_group_name', - help=_( - "Resouce Group Name specified at creating tenant NW.")), - cfg.StrOpt('region_name', - help=_("RegionName for DC."), - default='RegionOne'), - cfg.IntOpt('scenario_polling_first_timer', default=2, - help=_("Timer value for the first scenario status polling.")), - cfg.IntOpt('scenario_polling_timer', default=10, - help=_("Timer value for polling scenario status.")), - cfg.IntOpt('scenario_polling_count', default=6, - help=_("Count value for polling scenario status.")), - cfg.BoolOpt('use_necnwa_router', - help=_("Using necnwa_router instead of the l3-router"), - default=True), - cfg.BoolOpt('use_neutron_vlan_id', - help=_("Using vlan id of neutron instead of NWA"), - default=False), - cfg.StrOpt('ironic_az_prefix', - help=_("The prefix name of device_owner used in ironic"), - default='BM_'), - cfg.BoolOpt('use_setting_fw_policy', - default=False, - help=_('Using setting_fw_policy as default')), - cfg.StrOpt('resource_group_file', - help=_("JSON file which defines relations between " - "physical network of OpenStack and NWA.")), - cfg.StrOpt('resource_group', - deprecated_for_removal=True, - deprecated_reason='In favor of resource_group_file option.', - help=_(""" - Relations between physical network of OpenStack and NWA. - ex) - [ - { - "physical_network": "physnet1", - "ResourceGroupName":"Core/Hypervisor/HV-RG01" - }, - { ... }, - ]""")), - cfg.StrOpt('lbaas_driver', - help=_("LBaaS Driver Name")), - cfg.StrOpt('fwaas_driver', - help=_("Firewall Driver Name")), -] - -Scenario_opts = [ - cfg.StrOpt('CreateTenantFW', - help=_("Scenario ID for the scenario CreateTenantFW.")), - cfg.StrOpt('CreateTenantNW', - help=_("Scenario ID for the scenario CreateTenantNW.")), - cfg.StrOpt('CreateVLAN', - help=_("Scenario ID for the scenario CreateVLAN.")), - cfg.StrOpt('CreateGeneralDev', - help=_( - "Scenario ID for the scenario CreateGeneralDev.")), - cfg.StrOpt('UpdateTenantFW', - help=_("Scenario ID for the scenario UpdateTenantFW.")), - cfg.StrOpt('SettingNAT', - help=_("Scenario ID for the scenario SettingNAT.")), -] - -cfg.CONF.register_opts(NWA_opts, "NWA") -cfg.CONF.register_opts(Scenario_opts, "Scenario") diff --git a/networking_nec/nwa/common/constants.py b/networking_nec/nwa/common/constants.py deleted file mode 100644 index 53e6e75..0000000 --- a/networking_nec/nwa/common/constants.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -NWA_DEVICE_GDV = "GeneralDev" -NWA_DEVICE_TFW = "TenantFW" - -NWA_AGENT_TOPIC = 'nwa_agent' -NWA_AGENT_TYPE = 'NEC NWA Agent' - -NWA_FIREWALL_PLUGIN = 'NECNWAFWaaS' - -# an incremental size if the remaining size is zero. -NWA_GREENPOOL_ADD_SIZE = 32 diff --git a/networking_nec/nwa/common/exceptions.py b/networking_nec/nwa/common/exceptions.py deleted file mode 100644 index b1e9c5f..0000000 --- a/networking_nec/nwa/common/exceptions.py +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron_lib import exceptions as n_exc - -from networking_nec._i18n import _ - - -class NWAClientError(n_exc.NeutronException): - message = _('NWAClient Error %(msg)s') - - -class NWAUtilsError(n_exc.NeutronException): - message = _('NWAUtils Error %(msg)s') - - -class TenantNotFound(n_exc.NeutronException): - message = _('NWA Tenant %(tenant_id)s not found') - - -class ResourceGroupNameNotFound(n_exc.NotFound): - message = _("ResourceGroupName %(device_owner)s could not be found") - - -class AgentProxyException(Exception): - def __init__(self, value=None): - super(AgentProxyException, self).__init__() - self.value = value diff --git a/networking_nec/nwa/common/utils.py b/networking_nec/nwa/common/utils.py deleted file mode 100644 index 5b02ef5..0000000 --- a/networking_nec/nwa/common/utils.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_config import cfg -from oslo_log import log as logging -from oslo_serialization import jsonutils - -from networking_nec._i18n import _, _LE, _LW -# It is required to register nwa options -from networking_nec.nwa.common import config # noqa - -LOG = logging.getLogger(__name__) - - -def get_nwa_tenant_id(tenant_id): - return cfg.CONF.NWA.region_name + tenant_id - - -def get_tenant_info(context): - tenant_id = context.network.current['tenant_id'] - nwa_tenant_id = get_nwa_tenant_id(tenant_id) - return tenant_id, nwa_tenant_id - - -def load_json_from_file(name, json_file, json_str, default_value): - if json_file: - json_file_abspath = cfg.CONF.find_file(json_file) - if not json_file_abspath: - LOG.error(_LE('Failed to load %(name)s_file' - '"%(json_file)s": file not found'), - {'name': name, 'json_file': json_file}) - raise cfg.Error(_('NECNWA option parse error')) - try: - with open(json_file_abspath) as f: - return jsonutils.loads(f.read()) - except Exception as e: - LOG.error(_LE('Failed to load %(name)s_file ' - '"%(json_file)s": %(reason)s'), - {'reason': e, 'name': name, 'json_file': json_file}) - raise cfg.Error(_('NECNWA option parse error')) - elif json_str: - try: - return jsonutils.loads(json_str) - except Exception as e: - LOG.error(_LE('NECNWA option error during loading %(name)s ' - '(%(data)s): %(reason)s'), - {'reason': e, 'name': name, 'data': json_str}) - raise cfg.Error(_('NECNWA option parse error')) - else: - LOG.warning(_LW('%(name)s is not configured. ' - 'Make sure to set [NWA] %(name)s_file ' - 'in NWA plugin configuration file. ' - 'Using %(default)s as default value.'), - {'name': name, 'default': default_value}) - return default_value diff --git a/networking_nec/nwa/l2/__init__.py b/networking_nec/nwa/l2/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/l2/db_api.py b/networking_nec/nwa/l2/db_api.py deleted file mode 100644 index 0c65c14..0000000 --- a/networking_nec/nwa/l2/db_api.py +++ /dev/null @@ -1,200 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.plugins.ml2 import models as models_ml2 -import sqlalchemy as sa -from sqlalchemy import and_ - -from networking_nec.nwa.l2 import models as nmodels - - -class NWATenantBinding(object): - """Relation between OpenStack Tenant ID and NWA Tenant ID.""" - def __init__(self, tenant_id, nwa_tenant_id, value_json): - self.tenant_id = tenant_id - self.nwa_tenant_id = nwa_tenant_id - self.value_json = value_json - - def __repr__(self): - return "" % ( - self.tenant_id, self.nwa_tenant_id, self.value_json - ) - - -def add_nwa_tenant_binding(session, tenant_id, nwa_tenant_id, json_value): - try: - if not isinstance(json_value, dict): - return False - nwa = session.query(nmodels.NWATenantKeyValue).filter( - nmodels.NWATenantKeyValue.tenant_id == tenant_id).all() - if nwa: - return False - with session.begin(subtransactions=True): - for json_key, json_value in json_value.items(): - item = nmodels.NWATenantKeyValue(tenant_id, nwa_tenant_id, - json_key, json_value) - session.add(item) - return True - except sa.orm.exc.NoResultFound: - return False - - -def convert_if_special_value(s): - if s == 'True' or s == '1': - return True - if s == 'False' or s == '0': - return False - return s - - -def get_nwa_tenant_binding(session, tenant_id, nwa_tenant_id): - try: - value_json = { - nwa.json_key: convert_if_special_value(nwa.json_value) - for nwa in session.query(nmodels.NWATenantKeyValue).filter( - nmodels.NWATenantKeyValue.tenant_id == tenant_id).filter( - nmodels.NWATenantKeyValue.nwa_tenant_id == - nwa_tenant_id).all() - } - if value_json: - return NWATenantBinding(tenant_id, nwa_tenant_id, value_json) - else: - return None - except sa.orm.exc.NoResultFound: - return None - - -def set_nwa_tenant_binding(session, tenant_id, nwa_tenant_id, value_json): - item = get_nwa_tenant_binding(session, tenant_id, nwa_tenant_id) - if not item: - return False - _json = item.value_json - if not isinstance(_json, dict): - return False - if not isinstance(value_json, dict): - return False - with session.begin(subtransactions=True): - for key, value in value_json.items(): - if key in _json: - if value != _json[key]: - # update - item = session.query(nmodels.NWATenantKeyValue).filter( - and_(nmodels.NWATenantKeyValue.tenant_id == tenant_id, - nmodels.NWATenantKeyValue.json_key == key)).one() - item.json_value = value - else: - # insert - # item = nmodels.NWATenantKeyValue( - # tenant_id, nwa_tenant_id, key, value) - # session.add(item) - insert = ("INSERT INTO nwa_tenant_key_value (tenant_id," - "nwa_tenant_id,json_key,json_value) " - " VALUES (\'%s\',\'%s\',\'%s\',\'%s\') " - "ON DUPLICATE KEY UPDATE " - " json_value=\'%s\'" % (tenant_id, nwa_tenant_id, - key, value, value)) - session.execute(insert) - for key, value in _json.items(): - if key not in value_json: - # delete - item = session.query(nmodels.NWATenantKeyValue).filter( - and_(nmodels.NWATenantKeyValue.tenant_id == tenant_id, - nmodels.NWATenantKeyValue.json_key == key)).one() - session.delete(item) - return True - - -def del_nwa_tenant_binding(session, tenant_id, nwa_tenant_id): - try: - with session.begin(subtransactions=True): - item = get_nwa_tenant_binding(session, tenant_id, nwa_tenant_id) - if not item: - return False - with session.begin(subtransactions=True): - session.query(nmodels.NWATenantKeyValue).filter( - and_(nmodels.NWATenantKeyValue.tenant_id == tenant_id, - nmodels.NWATenantKeyValue.nwa_tenant_id == - nwa_tenant_id)).delete() - return True - except sa.orm.exc.NoResultFound: - return False - - -def ensure_port_binding(session, port_id): - - with session.begin(subtransactions=True): - try: - record = (session.query(models_ml2.PortBindingLevel). - filter_by(port_id=port_id). - one()) - except sa.orm.exc.NoResultFound: - # for kilo(re mearge) - record = (session.query(models_ml2.PortBinding). - filter_by(port_id=port_id). - one()) - return record - - -def add_nwa_tenant_queue(session, tenant_id, nwa_tenant_id='', topic=''): - try: - nwa = session.query(nmodels.NWATenantQueue).filter( - nmodels.NWATenantQueue.tenant_id == tenant_id).all() - if nwa: - return False - with session.begin(subtransactions=True): - nwa = nmodels.NWATenantQueue( - tenant_id, - nwa_tenant_id, - topic - ) - session.add(nwa) - return True - except sa.orm.exc.NoResultFound: - return False - - -def get_nwa_tenant_queue(session, tenant_id): - try: - queue = session.query(nmodels.NWATenantQueue).filter( - nmodels.NWATenantQueue.tenant_id == tenant_id).one() - - if queue: - return queue - else: - return None - except sa.orm.exc.NoResultFound: - return None - - -def get_nwa_tenant_queues(session): - try: - queues = session.query(nmodels.NWATenantQueue).all() - return queues - except sa.orm.exc.NoResultFound: - return None - - -def del_nwa_tenant_queue(session, tenant_id): - try: - with session.begin(subtransactions=True): - item = get_nwa_tenant_queue(session, tenant_id) - if not item: - return False - with session.begin(subtransactions=True): - session.query(nmodels.NWATenantQueue).filter( - nmodels.NWATenantQueue.tenant_id == tenant_id - ).delete() - return True - except sa.orm.exc.NoResultFound: - return False diff --git a/networking_nec/nwa/l2/drivers/__init__.py b/networking_nec/nwa/l2/drivers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/l2/drivers/mech_necnwa.py b/networking_nec/nwa/l2/drivers/mech_necnwa.py deleted file mode 100644 index 6fd8daf..0000000 --- a/networking_nec/nwa/l2/drivers/mech_necnwa.py +++ /dev/null @@ -1,261 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.common import constants as neutron_const -from neutron.common import utils -from neutron.db import segments_db as db_ml2 -from neutron.extensions import portbindings -from neutron.extensions import providernet as prov_net -from neutron.plugins.common import constants as plugin_const -from neutron.plugins.ml2 import driver_api as api -from neutron.plugins.ml2.drivers.openvswitch.mech_driver \ - import mech_openvswitch as ovs -from neutron_lib import constants -from oslo_config import cfg -from oslo_log import log as logging - -from networking_nec._i18n import _LW -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.nwa.common import utils as nwa_com_utils -from networking_nec.nwa.l2 import utils as nwa_l2_utils -from networking_nec.nwa.l3 import db_api as nwa_l3_db -from networking_nec.nwa.l3.rpc import nwa_l3_proxy_api - -LOG = logging.getLogger(__name__) - - -class NECNWAMechanismDriver(ovs.OpenvswitchMechanismDriver): - - def initialize(self): - self.resource_groups = nwa_com_utils.load_json_from_file( - 'resource_group', cfg.CONF.NWA.resource_group_file, - cfg.CONF.NWA.resource_group, default_value=[]) - self.necnwa_router = cfg.CONF.NWA.use_necnwa_router - self.multi_dc = cfg.CONF.NWA.use_neutron_vlan_id - - def _get_l2api_proxy(self, context, tenant_id): - proxy = context._plugin.get_nwa_proxy(tenant_id, - context._plugin_context) - return proxy - - def _get_l3api_proxy(self, context, tenant_id): - proxy = context._plugin.get_nwa_proxy(tenant_id, - context.network._plugin_context) - return nwa_l3_proxy_api.NwaL3ProxyApi(proxy.client) - - def is_router(self, device_owner): - return device_owner in (constants.DEVICE_OWNER_ROUTER_INTF, - constants.DEVICE_OWNER_ROUTER_GW) - - def create_port_precommit(self, context): - if not self.necnwa_router: - return - device_owner = context._port['device_owner'] - if not self.is_router(device_owner): - LOG.warning(_LW("device owner missmatch device_owner=%s"), - device_owner) - return - self._l3_create_tenant_fw(context) - physical_network = self._find_nwa_physical_network(context) - if physical_network: - self._bind_segment_to_vif_type(context, physical_network) - - def update_port_precommit(self, context): - new_port = context.current - orig_port = context.original - if (not new_port['device_id'] and orig_port['device_id'] and - not new_port['device_owner'] and orig_port['device_owner']): - # device_id and device_owner are clear on VM deleted. - LOG.debug('original_port=%s', context.original) - LOG.debug('updated_port=%s', context.current) - self._l2_delete_general_dev(context, use_original_port=True) - - def delete_port_precommit(self, context): - tenant_id, nwa_tenant_id = nwa_com_utils.get_tenant_info(context) - device_owner = context._port['device_owner'] - device_id = context._port['device_id'] - - LOG.debug("tenant_id=%(tid)s, nwa_tenant_id=%(nid)s, " - "device_owner=%(dev)s", - {'tid': tenant_id, 'nid': nwa_tenant_id, - 'dev': device_owner}) - - if self.necnwa_router and self.is_router(device_owner): - self._l3_delete_tenant_fw(context) - elif device_owner == constants.DEVICE_OWNER_FLOATINGIP: - pass - elif device_owner == '' and device_id == '': - pass - else: - self._l2_delete_general_dev(context) - - def try_to_bind_segment_for_agent(self, context, segment, agent): - device_owner = context._port['device_owner'] - if not self.necnwa_router or not self.is_router(device_owner): - physical_network = self._find_nwa_physical_network(context, agent) - if physical_network: - self._bind_segment_to_vif_type(context, physical_network) - self._bind_port_nwa_debug_message(context) - self._l2_create_general_dev(context) - return True - LOG.warning(_LW("binding segment not found for agent=%s"), agent) - return super( - NECNWAMechanismDriver, self - ).try_to_bind_segment_for_agent(context, segment, agent) - - def _find_nwa_physical_network(self, context, ovs_agent=None): - mappings = {} - if ovs_agent: - mappings = ovs_agent['configurations'].get('bridge_mappings', {}) - for res in self.resource_groups: - if ovs_agent and res['ResourceGroupName'] not in mappings: - continue - if res['device_owner'] == context._port['device_owner']: - return res['ResourceGroupName'] - - def _bind_segment_to_vif_type(self, context, physical_network): - if self.multi_dc: - return - network_id = context.network.current['id'] - session = context.network._plugin_context.session - dummy_segment = db_ml2.get_dynamic_segment( - session, network_id, physical_network=physical_network) - LOG.debug("1st: dummy segment is %s", dummy_segment) - if not dummy_segment: - dummy_segment = { - api.PHYSICAL_NETWORK: physical_network, - api.NETWORK_TYPE: plugin_const.TYPE_VLAN, - api.SEGMENTATION_ID: 0 - } - db_ml2.add_network_segment( - session, network_id, dummy_segment, is_dynamic=True) - LOG.debug("2nd: dummy segment is %s", dummy_segment) - context.set_binding(dummy_segment[api.ID], - self.vif_type, - {portbindings.CAP_PORT_FILTER: True, - portbindings.OVS_HYBRID_PLUG: True}) - - def _bind_port_nwa_debug_message(self, context): - network_name, network_id = nwa_l2_utils.get_network_info(context) - device_owner = context._port['device_owner'] - - subnet_ids = [] - if 'fixed_ips' in context._port: - for fixed_ip in context._port['fixed_ips']: - subnet_ids.append(fixed_ip['subnet_id']) - - segmentation_id = 0 - if prov_net.PHYSICAL_NETWORK in context.network.current: - segmentation_id = context.network.current[prov_net.SEGMENTATION_ID] - else: - for provider in context.network.current['segments']: - if (provider.get(prov_net.PHYSICAL_NETWORK) == - nwa_l2_utils.get_physical_network( - device_owner, self.resource_groups)): - segmentation_id = provider[prov_net.SEGMENTATION_ID] - break - - LOG.debug("provider segmentation_id = %s", segmentation_id) - LOG.debug("_bind_port_nwa %(network_name)s " - "%(network_id)s %(device_id)s %(device_owner)s " - "%(port_id)s %(mac_address)s %(subnet_ids)s " - "%(segmentation_id)s", - {'network_name': network_name, - 'network_id': network_id, - 'device_id': context._port['device_id'], - 'device_owner': device_owner, - 'port_id': context._port['id'], - 'mac_address': context._port['mac_address'], - 'subnet_ids': subnet_ids, - 'segmentation_id': segmentation_id}) - - def _l2_create_general_dev(self, context): - kwargs = self._make_l2api_kwargs(context) - proxy = self._get_l2api_proxy(context, kwargs['tenant_id']) - proxy.create_general_dev(context.network._plugin_context, **kwargs) - - def _l2_delete_general_dev(self, context, use_original_port=False): - try: - kwargs = self._make_l2api_kwargs( - context, use_original_port=use_original_port) - self._l2_delete_segment(context, kwargs['nwa_info']) - proxy = self._get_l2api_proxy(context, kwargs['tenant_id']) - kwargs['nwa_info'] = self._revert_dhcp_agent_device_id( - context, kwargs['nwa_info']) - proxy.delete_general_dev(context.network._plugin_context, **kwargs) - except nwa_exc.TenantNotFound as e: - LOG.warning(_LW("skip delete_general_dev: %s"), e) - - def _make_l2api_kwargs(self, context, use_original_port=False): - tenant_id, nwa_tenant_id = nwa_com_utils.get_tenant_info(context) - nwa_info = nwa_l2_utils.portcontext_to_nwa_info( - context, self.resource_groups, use_original_port) - return { - 'tenant_id': tenant_id, - 'nwa_tenant_id': nwa_tenant_id, - 'nwa_info': nwa_info - } - - def _revert_dhcp_agent_device_id(self, context, nwa_info): - device_owner = context._port['device_owner'] - device_id = context._port['device_id'] - if device_owner == constants.DEVICE_OWNER_DHCP and \ - device_id == neutron_const.DEVICE_ID_RESERVED_DHCP_PORT: - # get device_id of dhcp agent even if it is reserved. - nwa_info['device']['id'] = utils.get_dhcp_agent_device_id( - context.network.current['id'], - context._port.get('binding:host_id') - ) - return nwa_info - - def _l2_delete_segment(self, context, nwa_info): - session = context.network._plugin_context.session - del_segment = db_ml2.get_dynamic_segment( - session, - context.network.current['id'], - physical_network=nwa_info['physical_network']) - if del_segment: - LOG.debug('delete_network_segment %s', del_segment) - db_ml2.delete_network_segment(session, del_segment['id']) - - def _l3_create_tenant_fw(self, context): - device_owner = context._port['device_owner'] - grplst = [res['device_owner'] for res in self.resource_groups] - if device_owner not in grplst: - raise nwa_exc.ResourceGroupNameNotFound(device_owner=device_owner) - - kwargs = self._make_l3api_kwargs(context) - proxy = self._get_l3api_proxy(context, kwargs['tenant_id']) - proxy.create_tenant_fw(context.network._plugin_context, **kwargs) - - def _l3_delete_tenant_fw(self, context): - kwargs = self._make_l3api_kwargs(context) - proxy = self._get_l3api_proxy(context, kwargs['tenant_id']) - proxy.delete_tenant_fw(context.network._plugin_context, **kwargs) - - def _make_l3api_kwargs(self, context): - rt_tid = nwa_l3_db.get_tenant_id_by_router( - context.network._plugin_context.session, - context._port['device_id'] - ) - nwa_rt_tid = nwa_com_utils.get_nwa_tenant_id(rt_tid) - nwa_info = nwa_l2_utils.portcontext_to_nwa_info( - context, self.resource_groups) - nwa_info['tenant_id'] = rt_tid # overwrite by router's - nwa_info['nwa_tenant_id'] = nwa_rt_tid # tenant_id and nwa_tenant_id - return { - 'tenant_id': rt_tid, - 'nwa_tenant_id': nwa_rt_tid, - 'nwa_info': nwa_info - } diff --git a/networking_nec/nwa/l2/models.py b/networking_nec/nwa/l2/models.py deleted file mode 100644 index 4e1248d..0000000 --- a/networking_nec/nwa/l2/models.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron_lib.db import model_base -import sqlalchemy as sa - - -class NWATenantKeyValue(model_base.BASEV2): - """Key and value database of NWW tenant""" - __tablename__ = 'nwa_tenant_key_value' - - tenant_id = sa.Column(sa.String(36), primary_key=True) - nwa_tenant_id = sa.Column(sa.String(64)) - json_key = sa.Column(sa.String(192), nullable=False, - default='', primary_key=True) - json_value = sa.Column(sa.String(1024), nullable=False, - default='') - - def __init__(self, tenant_id, nwa_tenant_id, json_key, json_value): - self.tenant_id = tenant_id - self.nwa_tenant_id = nwa_tenant_id - self.json_key = json_key - self.json_value = json_value - - def __repr__(self): - return "" % ( - self.tenant_id, self.nwa_tenant_id, - {self.json_key: self.json_value} - ) - - -class NWATenantQueue(model_base.BASEV2): - """Queue for each NWA Tenant between server and agent""" - __tablename__ = 'nwa_tenant_queue' - - tenant_id = sa.Column(sa.String(36), primary_key=True) - nwa_tenant_id = sa.Column(sa.String(64)) - topic = sa.Column(sa.String(128), default='') - - def __init__(self, tenant_id, nwa_tenant_id, topic): - self.tenant_id = tenant_id - self.nwa_tenant_id = nwa_tenant_id - self.topic = topic - - def __repr__(self): - return "" % ( - self.tenant_id, - self.nwa_tenant_id, - self.topic - ) diff --git a/networking_nec/nwa/l2/plugin.py b/networking_nec/nwa/l2/plugin.py deleted file mode 100644 index 479b55b..0000000 --- a/networking_nec/nwa/l2/plugin.py +++ /dev/null @@ -1,183 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.api.rpc.handlers import dhcp_rpc -from neutron.api.rpc.handlers import metadata_rpc -from neutron.api.rpc.handlers import securitygroups_rpc -from neutron.common import rpc as n_rpc -from neutron.common import topics -from neutron.db import agents_db -from neutron.db import segments_db as db_ml2 -from neutron.extensions import multiprovidernet as mpnet -from neutron.extensions import providernet as provider -from neutron.plugins.ml2 import driver_api as api -from neutron.plugins.ml2 import plugin as ml2_plugin -from oslo_log import log as logging - -from networking_nec._i18n import _LE, _LI, _LW -from networking_nec.nwa.common import constants as nwa_const -from networking_nec.nwa.l2 import db_api as necnwa_api -from networking_nec.nwa.l2.rpc import ml2_server_callback -from networking_nec.nwa.l2.rpc import nwa_agent_api -from networking_nec.nwa.l2.rpc import nwa_l2_server_callback -from networking_nec.nwa.l2.rpc import nwa_proxy_api -from networking_nec.nwa.l2.rpc import tenant_binding_callback - -LOG = logging.getLogger(__name__) - - -class NECNWAL2Plugin(ml2_plugin.Ml2Plugin): - - def __init__(self): - super(NECNWAL2Plugin, self).__init__() - self._nwa_agent_rpc_setup() - - def _nwa_agent_rpc_setup(self): - self.nwa_rpc = nwa_agent_api.NECNWAAgentApi( - nwa_const.NWA_AGENT_TOPIC - ) - self.nwa_proxies = {} - - def start_rpc_listeners(self): - self.endpoints = [ - ml2_server_callback.NwaML2ServerRpcCallbacks( - self.notifier, self.type_manager), - nwa_l2_server_callback.NwaL2ServerRpcCallback(), - tenant_binding_callback.TenantBindingServerRpcCallback(), - securitygroups_rpc.SecurityGroupServerRpcCallback(), - dhcp_rpc.DhcpRpcCallback(), - agents_db.AgentExtRpcCallback(), - metadata_rpc.MetadataRpcCallback()] - - self.topic = topics.PLUGIN - self.conn = n_rpc.create_connection() - self.conn.create_consumer(self.topic, self.endpoints, - fanout=False) - return self.conn.consume_in_threads() - - def _extend_network_dict_provider(self, context, network): - if 'id' not in network: - LOG.debug("Network has no id") - network[provider.NETWORK_TYPE] = None - network[provider.PHYSICAL_NETWORK] = None - network[provider.SEGMENTATION_ID] = None - return - - net_id = network['id'] - segments = db_ml2.get_network_segments( - context.session, net_id, filter_dynamic=True) - - if not segments: - LOG.debug("Network %s has no segments", net_id) - network[provider.NETWORK_TYPE] = None - network[provider.PHYSICAL_NETWORK] = None - network[provider.SEGMENTATION_ID] = None - elif len(segments) > 1: - network[mpnet.SEGMENTS] = [ - {provider.NETWORK_TYPE: segment[api.NETWORK_TYPE], - provider.PHYSICAL_NETWORK: segment[api.PHYSICAL_NETWORK], - provider.SEGMENTATION_ID: segment[api.SEGMENTATION_ID]} - for segment in segments] - else: - segment = segments[0] - network[provider.NETWORK_TYPE] = segment[api.NETWORK_TYPE] - network[provider.PHYSICAL_NETWORK] = segment[api.PHYSICAL_NETWORK] - network[provider.SEGMENTATION_ID] = segment[api.SEGMENTATION_ID] - - # pylint: disable=redefined-builtin - def get_network(self, context, id, fields=None): - session = context.session - - with session.begin(subtransactions=True): - network = self._get_network(context, id) - result = self._make_network_dict(network, fields) - self._extend_network_dict_provider(context, result) - - return self._fields(result, fields) - - def get_networks(self, context, filters=None, fields=None, - sorts=None, limit=None, marker=None, page_reverse=False): - return super( - NECNWAL2Plugin, - self - ).get_networks(context, filters, None, sorts, - limit, marker, page_reverse) - - def _create_nwa_agent_tenant_queue(self, context, tenant_id): - if ( - self._is_alive_nwa_agent(context) and - necnwa_api.get_nwa_tenant_queue( - context.session, - tenant_id - ) is None - ): - self.nwa_rpc.create_server(context, tenant_id) - necnwa_api.add_nwa_tenant_queue(context.session, tenant_id) - else: - LOG.warning(_LW('%s is not alive.'), - nwa_const.NWA_AGENT_TYPE) - - def create_network(self, context, network): - result = super(NECNWAL2Plugin, - self).create_network(context, network) - self._create_nwa_agent_tenant_queue(context, context.tenant_id) - return result - - def delete_network(self, context, id): - result = super(NECNWAL2Plugin, - self).delete_network(context, id) - return result - - def create_port(self, context, port): - result = super(NECNWAL2Plugin, - self).create_port(context, port) - - return result - - def get_nwa_topics(self, context, tid): - rss = self.nwa_rpc.get_nwa_rpc_servers(context) - if isinstance(rss, dict) and rss.get('nwa_rpc_servers'): - return [t.get('topic') for t in rss['nwa_rpc_servers'] - if t.get('tenant_id') == tid] - else: - return [] - - def get_nwa_proxy(self, tid, context=None): - if tid not in self.nwa_proxies: - self.nwa_proxies[tid] = nwa_proxy_api.NECNWAProxyApi( - nwa_const.NWA_AGENT_TOPIC, tid - ) - if context: - self._create_nwa_agent_tenant_queue(context, tid) - nwa_topics = self.get_nwa_topics(context, tid) - if len(nwa_topics) == 1: - LOG.info(_LI('NWA tenant queue: new topic is %s'), - str(nwa_topics[0])) - else: - LOG.warning(_LW('NWA tenant queue is not created. tid=%s'), - tid) - LOG.debug('proxy tid=%s', tid) - return self.nwa_proxies[tid] - - def _is_alive_nwa_agent(self, context): - agents = self.get_agents( - context, - filters={'agent_type': [nwa_const.NWA_AGENT_TYPE]} - ) - return any(agent['alive'] for agent in agents) - - # This needs to be defined to avoid pylint abstract-method check. - def get_port_from_device(self, context, device): - LOG.error(_LE('This method should not be called. ' - 'get_ports_from_devices is used.')) diff --git a/networking_nec/nwa/l2/rpc/__init__.py b/networking_nec/nwa/l2/rpc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/l2/rpc/ml2_server_callback.py b/networking_nec/nwa/l2/rpc/ml2_server_callback.py deleted file mode 100644 index b9a9056..0000000 --- a/networking_nec/nwa/l2/rpc/ml2_server_callback.py +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_config import cfg - -from neutron.extensions import portbindings -from neutron.extensions import portsecurity as psec -from neutron.plugins.ml2 import driver_api as api -from neutron.plugins.ml2 import rpc -from neutron.services.qos import qos_consts -from neutron_lib import constants -from neutron_lib.plugins import directory -from oslo_log import log as logging - -from networking_nec._i18n import _LW, _LI - - -LOG = logging.getLogger(__name__) - - -class NwaML2ServerRpcCallbacks(rpc.RpcCallbacks): - - RPC_VERSION = '1.0' - - def __init__(self, notifier, type_manager, necnwa_router=True): - super(NwaML2ServerRpcCallbacks, self).__init__(notifier, type_manager) - self.necnwa_router = cfg.CONF.NWA.use_necnwa_router - - def get_device_details(self, rpc_context, **kwargs): - """Agent requests device details.""" - agent_id = kwargs.get('agent_id') - device = kwargs.get('device') - host = kwargs.get('host') - # cached networks used for reducing number of network db calls - # for server internal usage only - cached_networks = kwargs.get('cached_networks') - LOG.debug("Device %(device)s details requested by agent " - "%(agent_id)s with host %(host)s", - {'device': device, 'agent_id': agent_id, 'host': host}) - - plugin = directory.get_plugin() - port_id = plugin._device_to_port_id(rpc_context, device) - port_context = plugin.get_bound_port_context(rpc_context, - port_id, - host, - cached_networks) - if not port_context: - LOG.debug("Device %(device)s requested by agent " - "%(agent_id)s not found in database", - {'device': device, 'agent_id': agent_id}) - return {'device': device} - - segment = port_context.bottom_bound_segment - port = port_context.current - # caching information about networks for future use - if cached_networks is not None: - if port['network_id'] not in cached_networks: - cached_networks[port['network_id']] = ( - port_context.network.current) - - if not segment: - LOG.warning(_LW("Device %(device)s requested by agent " - "%(agent_id)s on network %(network_id)s not " - "bound, vif_type: %(vif_type)s"), - {'device': device, - 'agent_id': agent_id, - 'network_id': port['network_id'], - 'vif_type': port_context.vif_type}) - return {'device': device} - - if segment['segmentation_id'] == 0: - entry = {'device': device} - LOG.info(_LI('The segmentation_id is not yet finalized, ' - 'it is replaced to return %s'), entry) - return entry - - if not host or host == port_context.host: - new_status = (constants.PORT_STATUS_BUILD if port['admin_state_up'] - else constants.PORT_STATUS_DOWN) - if ( - port['status'] != new_status and - port['status'] != constants.PORT_STATUS_ACTIVE - ): - plugin.update_port_status(rpc_context, - port_id, - new_status, - host, - port_context.network.current) - - network_qos_policy_id = port_context.network._network.get( - qos_consts.QOS_POLICY_ID) - entry = {'device': device, - 'network_id': port['network_id'], - 'port_id': port['id'], - 'mac_address': port['mac_address'], - 'admin_state_up': port['admin_state_up'], - 'network_type': segment[api.NETWORK_TYPE], - 'segmentation_id': segment[api.SEGMENTATION_ID], - 'physical_network': segment[api.PHYSICAL_NETWORK], - 'fixed_ips': port['fixed_ips'], - 'device_owner': port['device_owner'], - 'allowed_address_pairs': port['allowed_address_pairs'], - 'port_security_enabled': port.get(psec.PORTSECURITY, True), - 'qos_policy_id': port.get(qos_consts.QOS_POLICY_ID), - 'network_qos_policy_id': network_qos_policy_id, - 'profile': port[portbindings.PROFILE]} - if 'security_groups' in port: - entry['security_groups'] = port['security_groups'] - LOG.debug("Returning: %s", entry) - return entry - - def update_device_up(self, rpc_context, **kwargs): - """Device is up on agent.""" - if self.necnwa_router: - return - super(NwaML2ServerRpcCallbacks, self).update_device_up(rpc_context, - **kwargs) diff --git a/networking_nec/nwa/l2/rpc/nwa_agent_api.py b/networking_nec/nwa/l2/rpc/nwa_agent_api.py deleted file mode 100644 index b8943bd..0000000 --- a/networking_nec/nwa/l2/rpc/nwa_agent_api.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -from neutron.common import rpc as n_rpc -import oslo_messaging - - -class NECNWAAgentApi(object): - BASE_RPC_API_VERSION = '1.0' - - def __init__(self, topic): - target = oslo_messaging.Target(topic=topic, - version=self.BASE_RPC_API_VERSION) - self.client = n_rpc.get_client(target) - - def create_server(self, context, tenant_id): - cctxt = self.client.prepare() - return cctxt.cast(context, 'create_server', tenant_id=tenant_id) - - def delete_server(self, context, tenant_id): - cctxt = self.client.prepare() - return cctxt.cast(context, 'delete_server', tenant_id=tenant_id) - - def get_nwa_rpc_servers(self, context): - cctxt = self.client.prepare() - return cctxt.call(context, 'get_nwa_rpc_servers') diff --git a/networking_nec/nwa/l2/rpc/nwa_agent_callback.py b/networking_nec/nwa/l2/rpc/nwa_agent_callback.py deleted file mode 100644 index b6c293c..0000000 --- a/networking_nec/nwa/l2/rpc/nwa_agent_callback.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import helpers -import oslo_messaging - - -class NwaAgentRpcCallback(object): - - target = oslo_messaging.Target(version='1.0') - - def __init__(self, context, agent): - self.context = context - self.agent = agent - - @helpers.log_method_call - def get_nwa_rpc_servers(self, context, **kwargs): - return {'nwa_rpc_servers': - [ - { - 'tenant_id': k, - 'topic': v['topic'] - } for k, v in self.agent.rpc_servers.items() - ]} - - @helpers.log_method_call - def create_server(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - return self.agent.create_tenant_rpc_server(tenant_id) - - @helpers.log_method_call - def delete_server(self, context, **kwargs): - tenant_id = kwargs.get('tenant_id') - return self.agent.delete_tenant_rpc_server(tenant_id) diff --git a/networking_nec/nwa/l2/rpc/nwa_l2_server_api.py b/networking_nec/nwa/l2/rpc/nwa_l2_server_api.py deleted file mode 100644 index e54a06a..0000000 --- a/networking_nec/nwa/l2/rpc/nwa_l2_server_api.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.common import rpc as n_rpc -from neutron.plugins.ml2 import driver_api as api -import oslo_messaging - - -class NwaL2ServerRpcApi(object): - - BASE_RPC_API_VERSION = '1.0' - - def __init__(self, topic): - target = oslo_messaging.Target(topic=topic, - version=self.BASE_RPC_API_VERSION) - self.client = n_rpc.get_client(target) - - def get_nwa_network_by_port_id(self, context, port_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'get_nwa_network_by_port_id', - port_id=port_id - ) - - def get_nwa_network_by_subnet_id(self, context, subnet_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'get_nwa_network_by_subnet_id', - subnet_id=subnet_id - ) - - def get_nwa_network(self, context, network_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'get_nwa_network', - network_id=network_id - ) - - def get_nwa_networks(self, context, tenant_id, nwa_tenant_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'get_nwa_networks', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id - ) - - def update_port_state_with_notifier(self, context, device, agent_id, - port_id, segment, network_id): - physical_network = segment[api.PHYSICAL_NETWORK] - network_type = segment[api.NETWORK_TYPE] - segmentation_id = segment[api.SEGMENTATION_ID] - - cctxt = self.client.prepare() - return cctxt.call( - context, - 'update_port_state_with_notifier', - device=device, - agent_id=agent_id, - port_id=port_id, - network_id=network_id, - network_type=network_type, - segmentation_id=segmentation_id, - physical_network=physical_network - ) - - def release_dynamic_segment_from_agent(self, context, physical_network, - network_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'release_dynamic_segment_from_agent', - network_id=network_id, - physical_network=physical_network - ) diff --git a/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py b/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py deleted file mode 100644 index db6a676..0000000 --- a/networking_nec/nwa/l2/rpc/nwa_l2_server_callback.py +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.db import api as db_api -from neutron.db.models import segment as segments_db -from neutron.db import models_v2 -from neutron.db import segments_db as db_ml2 -from neutron_lib import constants -from neutron_lib.plugins import directory -from oslo_log import helpers -from oslo_log import log as logging -import oslo_messaging -from sqlalchemy.orm import exc as sa_exc - -from networking_nec._i18n import _LE - -LOG = logging.getLogger(__name__) - - -class NwaL2ServerRpcCallback(object): - - target = oslo_messaging.Target(version='1.0') - - def get_nwa_network_by_port_id(self, rpc_context, **kwargs): - plugin = directory.get_plugin() - port_id = kwargs.get('port_id') - port = plugin.get_port(rpc_context, port_id) - - network = plugin.get_network(rpc_context, port['network_id']) - - return network - - def get_nwa_network_by_subnet_id(self, rpc_context, **kwargs): - plugin = directory.get_plugin() - subnet_id = kwargs.get('subnet_id') - subnet = plugin.get_subnet(rpc_context, subnet_id) - - network = plugin.get_network(rpc_context, subnet['network_id']) - - return network - - def get_nwa_network(self, rpc_context, **kwargs): - plugin = directory.get_plugin() - net_id = kwargs.get('network_id') - network = plugin.get_network(rpc_context, net_id) - - return network - - def get_nwa_networks(self, rpc_context, **kwargs): - plugin = directory.get_plugin() - networks = plugin.get_networks(rpc_context) - - return networks - - @helpers.log_method_call - def update_port_state_with_notifier(self, rpc_context, **kwargs): - port_id = kwargs.get('port_id') - network_id = kwargs.get('network_id') - network_type = kwargs.get('network_type') - segmentation_id = kwargs.get('segmentation_id') - physical_network = kwargs.get('physical_network') - - # 1 update segment - session = db_api.get_session() - with session.begin(subtransactions=True): - try: - query = (session.query(segments_db.NetworkSegment). - filter_by(network_id=network_id)) - query = query.filter_by(physical_network=physical_network) - query = query.filter_by(is_dynamic=True) - record = query.one() - record.segmentation_id = segmentation_id - except sa_exc.NoResultFound: - pass - - # 2 change port state - plugin = directory.get_plugin() - plugin.update_port_status( - rpc_context, - port_id, - constants.PORT_STATUS_ACTIVE - ) - - # 3 serch db from port_id - session = db_api.get_session() - port = None - with session.begin(subtransactions=True): - try: - port_db = (session.query(models_v2.Port). - enable_eagerloads(False). - filter(models_v2.Port.id.startswith(port_id)). - one()) - port = plugin._make_port_dict(port_db) - except sa_exc.NoResultFound: - LOG.error(_LE("Can't find port with port_id %s"), - port_id) - except sa_exc.MultipleResultsFound: - LOG.error(_LE("Multiple ports have port_id starting with %s"), - port_id) - # 4 send notifier - if port is not None: - LOG.debug("notifier port_update %(net_type)s, %(seg_id)s, " - "%(physnet)s", - {'net_type': network_type, - 'seg_id': segmentation_id, - 'physnet': physical_network}) - plugin.notifier.port_update( - rpc_context, port, - network_type, - segmentation_id, - physical_network - ) - - return {} - - def release_dynamic_segment_from_agent(self, context, **kwargs): - network_id = kwargs.get('network_id') - physical_network = kwargs.get('physical_network') - - session = db_api.get_session() - del_segment = db_ml2.get_dynamic_segment( - session, network_id, physical_network=physical_network, - ) - if del_segment: - LOG.debug("release_dynamic_segment segment=%s", del_segment) - if del_segment['segmentation_id'] != 0: - db_ml2.delete_network_segment(session, del_segment['id']) diff --git a/networking_nec/nwa/l2/rpc/nwa_proxy_api.py b/networking_nec/nwa/l2/rpc/nwa_proxy_api.py deleted file mode 100644 index 6147758..0000000 --- a/networking_nec/nwa/l2/rpc/nwa_proxy_api.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -from neutron.common import rpc as n_rpc -import oslo_messaging - - -class NECNWAProxyApi(object): - BASE_RPC_API_VERSION = '1.0' - - def __init__(self, topic, tenant_id): - target = oslo_messaging.Target(topic='%s-%s' % (topic, tenant_id), - version=self.BASE_RPC_API_VERSION) - self._client = n_rpc.get_client(target) - - @property - def client(self): - return self._client - - def _send_msg(self, context, msg, blocking=False): - cctxt = self.client.prepare() - if blocking: - return cctxt.call(context, msg) - else: - return cctxt.cast(context, msg) - - def create_general_dev(self, context, tenant_id, nwa_tenant_id, nwa_info): - cctxt = self.client.prepare() - return cctxt.cast( - context, - 'create_general_dev', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - def delete_general_dev(self, context, tenant_id, nwa_tenant_id, nwa_info): - cctxt = self.client.prepare() - return cctxt.cast( - context, - 'delete_general_dev', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) diff --git a/networking_nec/nwa/l2/rpc/nwa_proxy_callback.py b/networking_nec/nwa/l2/rpc/nwa_proxy_callback.py deleted file mode 100644 index 0980396..0000000 --- a/networking_nec/nwa/l2/rpc/nwa_proxy_callback.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import log as logging -import oslo_messaging -from oslo_serialization import jsonutils - -LOG = logging.getLogger(__name__) - - -class NwaProxyCallback(object): - target = oslo_messaging.Target(version='1.0') - - def __init__(self, context, agent): - super(NwaProxyCallback, self).__init__() - self.context = context - self.agent = agent - - def create_general_dev(self, context, **kwargs): - LOG.debug("Rpc callback kwargs=%s", jsonutils.dumps( - kwargs, - indent=4, - sort_keys=True - )) - return self.agent.create_general_dev(context, **kwargs) - - def delete_general_dev(self, context, **kwargs): - LOG.debug("Rpc callback kwargs=%s", jsonutils.dumps( - kwargs, - indent=4, - sort_keys=True - )) - return self.agent.delete_general_dev(context, **kwargs) diff --git a/networking_nec/nwa/l2/rpc/tenant_binding_api.py b/networking_nec/nwa/l2/rpc/tenant_binding_api.py deleted file mode 100644 index 8b30755..0000000 --- a/networking_nec/nwa/l2/rpc/tenant_binding_api.py +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.common import rpc as n_rpc -import oslo_messaging - - -class TenantBindingServerRpcApi(object): - - BASE_RPC_API_VERSION = '1.0' - - def __init__(self, topic): - target = oslo_messaging.Target(topic=topic, - version=self.BASE_RPC_API_VERSION) - self.client = n_rpc.get_client(target) - - def get_nwa_tenant_binding(self, context, tenant_id, nwa_tenant_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'get_nwa_tenant_binding', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id - ) - - def add_nwa_tenant_binding(self, context, tenant_id, - nwa_tenant_id, nwa_data): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'add_nwa_tenant_binding', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_data=nwa_data - ) - - def set_nwa_tenant_binding(self, context, tenant_id, - nwa_tenant_id, nwa_data): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'set_nwa_tenant_binding', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_data=nwa_data - ) - - def delete_nwa_tenant_binding(self, context, tenant_id, - nwa_tenant_id): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'delete_nwa_tenant_binding', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id - ) - - def update_tenant_rpc_servers(self, context, rpc_servers): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'update_tenant_rpc_servers', - servers=rpc_servers - ) diff --git a/networking_nec/nwa/l2/rpc/tenant_binding_callback.py b/networking_nec/nwa/l2/rpc/tenant_binding_callback.py deleted file mode 100644 index 9d8e7a4..0000000 --- a/networking_nec/nwa/l2/rpc/tenant_binding_callback.py +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.db import api as db_api -from neutron_lib.plugins import directory -from oslo_log import helpers -from oslo_log import log as logging -import oslo_messaging -from oslo_serialization import jsonutils - -from networking_nec._i18n import _LI -from networking_nec.nwa.l2 import db_api as necnwa_api - -LOG = logging.getLogger(__name__) - - -class TenantBindingServerRpcCallback(object): - - target = oslo_messaging.Target(version='1.0') - - @helpers.log_method_call - def get_nwa_tenant_binding(self, rpc_context, **kwargs): - """get nwa_tenant_binding from neutorn db. - - @param rpc_context: rpc context. - @param kwargs: tenant_id, nwa_tenant_id - @return: success = dict of nwa_tenant_binding, error = dict of empty. - """ - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - - session = db_api.get_session() - with session.begin(subtransactions=True): - recode = necnwa_api.get_nwa_tenant_binding( - session, tenant_id, nwa_tenant_id - ) - if recode is not None: - LOG.debug( - "nwa_data=%s", jsonutils.dumps( - recode.value_json, indent=4, sort_keys=True) - ) - return recode.value_json - - return {} - - @helpers.log_method_call - def add_nwa_tenant_binding(self, rpc_context, **kwargs): - """get nwa_tenant_binding from neutorn db. - - @param rpc_context: rpc context. - @param kwargs: tenant_id, nwa_tenant_id - @return: dict of status - """ - - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_data = kwargs.get('nwa_data') - - session = db_api.get_session() - with session.begin(subtransactions=True): - if necnwa_api.add_nwa_tenant_binding( - session, - tenant_id, - nwa_tenant_id, - nwa_data - ): - return {'status': 'SUCCESS'} - - return {'status': 'FAILED'} - - @helpers.log_method_call - def set_nwa_tenant_binding(self, rpc_context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - nwa_data = kwargs.get('nwa_data') - LOG.debug( - "nwa_data=%s", jsonutils.dumps(nwa_data, indent=4, sort_keys=True) - ) - - session = db_api.get_session() - with session.begin(subtransactions=True): - if necnwa_api.set_nwa_tenant_binding( - session, - tenant_id, - nwa_tenant_id, - nwa_data - ): - return {'status': 'SUCCESS'} - - return {'status': 'FAILED'} - - @helpers.log_method_call - def delete_nwa_tenant_binding(self, rpc_context, **kwargs): - tenant_id = kwargs.get('tenant_id') - nwa_tenant_id = kwargs.get('nwa_tenant_id') - - session = db_api.get_session() - with session.begin(subtransactions=True): - if necnwa_api.del_nwa_tenant_binding( - session, - tenant_id, - nwa_tenant_id - ): - return {'status': 'SUCCESS'} - - return {'status': 'FAILED'} - - def update_tenant_rpc_servers(self, rpc_context, **kwargs): - session = db_api.get_session() - - with session.begin(subtransactions=True): - q_tids = [q.tenant_id - for q in necnwa_api.get_nwa_tenant_queues(session)] - plugin = directory.get_plugin() - tenant_ids = [server['tenant_id'] for server in kwargs['servers']] - ret = [] - for tenant_id in set(q_tids) - set(tenant_ids): - LOG.info(_LI("RPCServer only db tid=%s, send create_server"), - tenant_id) - plugin.nwa_rpc.create_server(rpc_context, tenant_id) - ret.append({'tenant_id': tenant_id}) - for tenant_id in set(tenant_ids) - set(q_tids): - LOG.info(_LI("RPCServer only agent tid=%s, send delete_server"), - tenant_id) - plugin.nwa_rpc.delete_server(rpc_context, tenant_id) - return {'servers': ret} diff --git a/networking_nec/nwa/l2/utils.py b/networking_nec/nwa/l2/utils.py deleted file mode 100644 index 23b4526..0000000 --- a/networking_nec/nwa/l2/utils.py +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.db.models import external_net as external_net_db -from neutron.db import segments_db as db_ml2 -from neutron.plugins.ml2 import driver_api as api -from neutron_lib import constants -from oslo_config import cfg -from oslo_log import log as logging -from sqlalchemy.orm import exc as sa_exc - -from networking_nec.nwa.common import utils as nwa_com_utils - -LOG = logging.getLogger(__name__) - - -def get_network_info(context): - name = context.network.current['name'] - network_id = context.network.current['id'] - return name, network_id - - -def get_physical_network(device_owner, resource_groups, - resource_group_name=None): - for physnet in resource_groups: - physnets = [physnet['physical_network'] for physnet in resource_groups - if (physnet['device_owner'] == device_owner and - (not resource_group_name or - physnet['ResourceGroupName'] == resource_group_name))] - if physnets: - return physnets[0] - return None - - -def is_external_network(context, net_id): - if hasattr(context, 'session'): - session = context.session - else: - session = context.network._plugin_context.session - try: - session.query( - external_net_db.ExternalNetwork).filter_by( - network_id=net_id - ).one() - return True - - except sa_exc.NoResultFound: - return False - - -def get_vlan_id_of_physical_network(context, network_id, physical_network): - if hasattr(context, 'session'): - session = context.session - else: - session = context.network._plugin_context.session - segments = db_ml2.get_network_segments(session, network_id) - if not segments: - return '' - for segment in segments: - if segment[api.PHYSICAL_NETWORK] == physical_network: - return str(segment[api.SEGMENTATION_ID]) - return str(segments[0][api.SEGMENTATION_ID]) - - -# pylint: disable=too-many-locals -def portcontext_to_nwa_info(context, resource_groups, - use_original_port=False): - tenant_id, nwa_tenant_id = nwa_com_utils.get_tenant_info(context) - network_name, network_id = get_network_info(context) - - port = context.original if use_original_port else context.current - device_owner = port['device_owner'] - resource_group_name = _get_resource_group_name(context, resource_groups, - use_original_port) - physical_network = get_physical_network(device_owner, resource_groups, - resource_group_name) - vlan_id = get_vlan_id_of_physical_network(context, network_id, - physical_network) - vlan_type = 'PublicVLAN' if is_external_network(context, network_id) \ - else 'BusinessVLAN' - - dbcontext = context._plugin_context - - nwa_info = { - 'tenant_id': tenant_id, - 'nwa_tenant_id': nwa_tenant_id, - 'network': {'id': network_id, - 'name': network_name, - 'vlan_id': vlan_id, - 'vlan_type': vlan_type}, - 'device': {'owner': device_owner, - 'id': port['device_id']}, - } - - if port['fixed_ips']: - subnet_id = port['fixed_ips'][0]['subnet_id'] - subnet = context._plugin.get_subnet(dbcontext, subnet_id) - nwa_info['subnet'] = {'id': subnet_id, - 'netaddr': subnet['cidr'].split('/')[0], - 'mask': subnet['cidr'].split('/')[1]} - nwa_info['port'] = {'id': port['id'], - 'ip': port['fixed_ips'][0]['ip_address'], - 'mac': port['mac_address']} - else: - nwa_info['subnet'] = {'id': '', - 'netaddr': '', - 'mask': ''} - nwa_info['port'] = {'id': port['id'], - 'ip': '', - 'mac': port['mac_address']} - - nwa_info['resource_group_name'] = resource_group_name - nwa_info['resource_group_name_nw'] = cfg.CONF.NWA.resource_group_name - nwa_info['physical_network'] = physical_network - return nwa_info - - -# Private methods - -def _get_resource_group_name(context, resource_groups, - use_original_port=False): - port = context.original if use_original_port else context.current - device_owner = port['device_owner'] - for agent in context.host_agents(constants.AGENT_TYPE_OVS): - if agent['alive']: - mappings = agent['configurations'].get('bridge_mappings', {}) - for res_grp in resource_groups: - if not res_grp['ResourceGroupName'] in mappings: - continue - if res_grp['device_owner'] == device_owner: - return res_grp['ResourceGroupName'] - - if (device_owner == constants.DEVICE_OWNER_ROUTER_INTF or - device_owner == constants.DEVICE_OWNER_ROUTER_GW): - for res_grp in resource_groups: - if res_grp['device_owner'] == device_owner: - return res_grp['ResourceGroupName'] - - return None diff --git a/networking_nec/nwa/l3/__init__.py b/networking_nec/nwa/l3/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/l3/db_api.py b/networking_nec/nwa/l3/db_api.py deleted file mode 100644 index 815db13..0000000 --- a/networking_nec/nwa/l3/db_api.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from sqlalchemy.orm import exc as sa_exc - -from neutron.db.models import l3 as l3_db -from oslo_log import log as logging - -LOG = logging.getLogger(__name__) - - -def get_tenant_id_by_router(session, router_id): - with session.begin(subtransactions=True): - try: - router = session.query(l3_db.Router).filter_by(id=router_id).one() - rt_tid = router.tenant_id - LOG.debug("rt_tid=%s", rt_tid) - return rt_tid - except sa_exc.NoResultFound: - LOG.debug("router not found %s", router_id) diff --git a/networking_nec/nwa/l3/plugin.py b/networking_nec/nwa/l3/plugin.py deleted file mode 100644 index 10f92da..0000000 --- a/networking_nec/nwa/l3/plugin.py +++ /dev/null @@ -1,229 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import sqlalchemy as sa -from sqlalchemy import or_ - -from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api -from neutron.api.rpc.handlers import l3_rpc -from neutron.common import rpc as n_rpc -from neutron.common import topics -from neutron.db import common_db_mixin -from neutron.db import extraroute_db -from neutron.db import l3_agentschedulers_db -from neutron.db import l3_gwmode_db -from neutron.db.models import l3 as l3_db -from neutron.plugins.common import constants -from neutron.plugins.ml2 import driver_context -from neutron.services import service_base -from neutron_lib import constants as n_const -from neutron_lib import exceptions as exc -from oslo_config import cfg -from oslo_log import helpers -from oslo_log import log as logging - -from networking_nec._i18n import _LI, _LW, _LE -from networking_nec.nwa.common import utils as nwa_com_utils -from networking_nec.nwa.l2 import db_api as nwa_db -from networking_nec.nwa.l2 import utils as nwa_l2_utils -from networking_nec.nwa.l3 import db_api as nwa_l3_db -from networking_nec.nwa.l3.rpc import nwa_l3_proxy_api -from networking_nec.nwa.l3.rpc import nwa_l3_server_callback - -LOG = logging.getLogger(__name__) - - -class NECNWAL3Plugin(service_base.ServicePluginBase, - common_db_mixin.CommonDbMixin, - extraroute_db.ExtraRoute_db_mixin, - l3_gwmode_db.L3_NAT_db_mixin, - l3_agentschedulers_db.L3AgentSchedulerDbMixin): - - supported_extension_aliases = ["router", "ext-gw-mode", - "extraroute"] - - def __init__(self): - super(NECNWAL3Plugin, self).__init__() - # l3_db.subscribe() - self.start_rpc_listeners() - self.nwa_proxies = {} - self.resource_groups = nwa_com_utils.load_json_from_file( - 'resource_group', cfg.CONF.NWA.resource_group_file, - cfg.CONF.NWA.resource_group, default_value=[]) - - @helpers.log_method_call - def start_rpc_listeners(self): - # RPC support - self.topic = topics.L3PLUGIN - self.conn = n_rpc.create_connection() - self.agent_notifiers.update( - {n_const.AGENT_TYPE_L3: l3_rpc_agent_api.L3AgentNotifyAPI()}) - self.endpoints = [l3_rpc.L3RpcCallback(), - nwa_l3_server_callback.NwaL3ServerRpcCallback()] - self.conn.create_consumer(self.topic, self.endpoints, - fanout=False) - return self.conn.consume_in_threads() - - def get_plugin_type(self): - return constants.L3_ROUTER_NAT - - def get_plugin_description(self): - """Returns string description of the plugin.""" - return "NEC NWA Plugin based routing" - - @helpers.log_method_call - def create_floatingip(self, context, floatingip, - initial_status=n_const.FLOATINGIP_STATUS_DOWN): - return super(NECNWAL3Plugin, self).create_floatingip( - context, floatingip, initial_status) - - def _delete_nat(self, context, fip): - if not fip['router_id'] or not fip['fixed_ip_address']: - LOG.debug('already deleted %s', fip) - return - tenant_id = nwa_l3_db.get_tenant_id_by_router( - context.session, fip['router_id'] - ) - nwa_tenant_id = nwa_com_utils.get_nwa_tenant_id(tenant_id) - - fl_data = { - 'floating_ip_address': fip['floating_ip_address'], - 'fixed_ip_address': fip['fixed_ip_address'], - 'id': fip['id'], - 'device_id': fip['router_id'], - 'floating_network_id': fip['floating_network_id'], - 'tenant_id': fip['tenant_id'] - } - LOG.info(_LI('delete_nat fl_data=%s'), fl_data) - - proxy = self._get_nwa_proxy(self, tenant_id) - proxy.delete_nat( - context, tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - floating=fl_data - ) - - # pylint: disable=arguments-differ - @helpers.log_method_call - def disassociate_floatingips(self, context, port_id, do_notify=True): - floating_ips = context.session.query(l3_db.FloatingIP).filter( - or_(l3_db.FloatingIP.fixed_port_id == port_id, - l3_db.FloatingIP.floating_port_id == port_id) - ) - if not floating_ips: - LOG.warning(_LW('floatingip not found %s'), port_id) - for fip in floating_ips: - self._delete_nat(context, fip) - router_ids = super(NECNWAL3Plugin, self).disassociate_floatingips( - context, port_id, do_notify) - return router_ids - - @helpers.log_method_call - def update_floatingip(self, context, fpid, floatingip): - port_id_specified = 'port_id' in floatingip['floatingip'] - if not port_id_specified: - LOG.error(_LE("port_id key is not found in %s"), floatingip) - raise exc.PortNotFound(port_id=None) - - port_id = floatingip['floatingip'].get('port_id') - try: - if port_id_specified and not port_id: - floating = context.session.query(l3_db.FloatingIP).filter_by( - id=fpid).one() - self._delete_nat(context, floating) - except sa.orm.exc.NoResultFound: - raise exc.PortNotFound(port_id=port_id) - - ret = super(NECNWAL3Plugin, self).update_floatingip( - context, fpid, floatingip) - - try: - if port_id_specified and port_id: - floating = context.session.query(l3_db.FloatingIP).filter_by( - id=fpid).one() - tenant_id = nwa_l3_db.get_tenant_id_by_router( - context.session, - floating['router_id'] - ) - nwa_tenant_id = nwa_com_utils.get_nwa_tenant_id(tenant_id) - - fl_data = { - 'floating_ip_address': floating['floating_ip_address'], - 'fixed_ip_address': floating['fixed_ip_address'], - 'id': fpid, 'device_id': floating['router_id'], - 'floating_network_id': floating['floating_network_id'], - 'tenant_id': floating['tenant_id'], - 'floating_port_id': floating['floating_port_id'] - } - LOG.info(_LI('setting_nat fl_data is %s'), fl_data) - proxy = self._get_nwa_proxy(self, tenant_id) - proxy.setting_nat( - context, tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - floating=fl_data - ) - - except sa.orm.exc.NoResultFound: - raise exc.PortNotFound(port_id=port_id) - - return ret - - def add_router_interface(self, context, router_id, interface_info): - ret = super(NECNWAL3Plugin, self).add_router_interface( - context, - router_id, - interface_info - ) - if 'port_id' in interface_info: - self._add_router_interface_by_port( - self, context, router_id, interface_info - ) - return ret - - def _add_router_interface_by_port(self, plugin, context, router_id, - interface_info): - try: - session = context.session - port = plugin._core_plugin._get_port(context, - interface_info['port_id']) - network = plugin._core_plugin.get_network(context, - port['network_id']) - - binding = nwa_db.ensure_port_binding(session, port['id']) - port_context = driver_context.PortContext(plugin._core_plugin, - context, port, - network, binding, None) - - nwa_info = nwa_l2_utils.portcontext_to_nwa_info( - port_context, self.resource_groups) - rt_tid = nwa_l3_db.get_tenant_id_by_router( - session, router_id - ) - nwa_rt_tid = nwa_com_utils.get_nwa_tenant_id(rt_tid) - nwa_info['tenant_id'] = rt_tid - nwa_info['nwa_tenant_id'] = nwa_rt_tid - proxy = self._get_nwa_proxy(plugin, rt_tid) - proxy.create_tenant_fw( - port_context.network._plugin_context, - rt_tid, - nwa_rt_tid, - nwa_info - ) - - except Exception as e: - LOG.exception(_LE("create tenant firewall %s"), e) - - def _get_nwa_proxy(self, plugin, tenant_id): - proxy = plugin._core_plugin.get_nwa_proxy(tenant_id) - return nwa_l3_proxy_api.NwaL3ProxyApi(proxy.client) diff --git a/networking_nec/nwa/l3/rpc/__init__.py b/networking_nec/nwa/l3/rpc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/l3/rpc/nwa_l3_proxy_api.py b/networking_nec/nwa/l3/rpc/nwa_l3_proxy_api.py deleted file mode 100644 index 9939fac..0000000 --- a/networking_nec/nwa/l3/rpc/nwa_l3_proxy_api.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import log as logging - -LOG = logging.getLogger(__name__) - - -class NwaL3ProxyApi(object): - - def __init__(self, client): - self.client = client - - def create_tenant_fw(self, context, tenant_id, nwa_tenant_id, nwa_info): - cctxt = self.client.prepare() - return cctxt.cast( - context, - 'create_tenant_fw', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - def delete_tenant_fw(self, context, tenant_id, nwa_tenant_id, nwa_info): - cctxt = self.client.prepare() - return cctxt.cast( - context, - 'delete_tenant_fw', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - def setting_nat(self, context, tenant_id, nwa_tenant_id, floating): - cctxt = self.client.prepare() - return cctxt.cast( - context, - 'setting_nat', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - floating=floating - ) - - def delete_nat(self, context, tenant_id, nwa_tenant_id, floating): - cctxt = self.client.prepare() - return cctxt.cast( - context, - 'delete_nat', - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - floating=floating - ) diff --git a/networking_nec/nwa/l3/rpc/nwa_l3_proxy_callback.py b/networking_nec/nwa/l3/rpc/nwa_l3_proxy_callback.py deleted file mode 100644 index c1b19fd..0000000 --- a/networking_nec/nwa/l3/rpc/nwa_l3_proxy_callback.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import helpers -from oslo_log import log as logging -import oslo_messaging - -LOG = logging.getLogger(__name__) - - -class NwaL3ProxyCallback(object): - - target = oslo_messaging.Target(version='1.0') - - def __init__(self, context, agent): - self.context = context - self.agent = agent - - @helpers.log_method_call - def create_tenant_fw(self, context, **kwargs): - return self.agent.create_tenant_fw(context, **kwargs) - - @helpers.log_method_call - def delete_tenant_fw(self, context, **kwargs): - return self.agent.delete_tenant_fw(context, **kwargs) - - @helpers.log_method_call - def setting_nat(self, context, **kwargs): - return self.agent.setting_nat(context, **kwargs) - - @helpers.log_method_call - def delete_nat(self, context, **kwargs): - return self.agent.delete_nat(context, **kwargs) diff --git a/networking_nec/nwa/l3/rpc/nwa_l3_server_api.py b/networking_nec/nwa/l3/rpc/nwa_l3_server_api.py deleted file mode 100644 index 70636c1..0000000 --- a/networking_nec/nwa/l3/rpc/nwa_l3_server_api.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.common import rpc as n_rpc -from oslo_log import log as logging -import oslo_messaging - -LOG = logging.getLogger(__name__) - - -class NwaL3ServerRpcApi(object): - - BASE_RPC_API_VERSION = '1.0' - - def __init__(self, topic): - target = oslo_messaging.Target(topic=topic, - version=self.BASE_RPC_API_VERSION) - self.client = n_rpc.get_client(target) - - def update_floatingip_status(self, context, floatingip_id, status): - cctxt = self.client.prepare() - return cctxt.call( - context, - 'update_floatingip_status', - floatingip_id=floatingip_id, - status=status - ) diff --git a/networking_nec/nwa/l3/rpc/nwa_l3_server_callback.py b/networking_nec/nwa/l3/rpc/nwa_l3_server_callback.py deleted file mode 100644 index 9337c18..0000000 --- a/networking_nec/nwa/l3/rpc/nwa_l3_server_callback.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.extensions import l3 -from neutron_lib import constants -from neutron_lib.plugins import directory -from oslo_log import log as logging -import oslo_messaging - -LOG = logging.getLogger(__name__) - - -class NwaL3ServerRpcCallback(object): - - target = oslo_messaging.Target(version='1.0') - - @property - def l3plugin(self): - if not hasattr(self, '_l3plugin'): - self._l3plugin = directory.get_plugin(constants.L3) - return self._l3plugin - - def update_floatingip_status(self, context, floatingip_id, status): - '''Update operational status for a floating IP.''' - with context.session.begin(subtransactions=True): - LOG.debug('New status for floating IP %s: %s' % - (floatingip_id, status)) - try: - self.l3plugin.update_floatingip_status(context, - floatingip_id, - status) - except l3.FloatingIPNotFound: - LOG.debug("Floating IP: %s no longer present.", - floatingip_id) diff --git a/networking_nec/nwa/nwalib/__init__.py b/networking_nec/nwa/nwalib/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/nwa/nwalib/client.py b/networking_nec/nwa/nwalib/client.py deleted file mode 100644 index 08eb6bf..0000000 --- a/networking_nec/nwa/nwalib/client.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from networking_nec.nwa.nwalib import client_fwaas -from networking_nec.nwa.nwalib import client_l2 -from networking_nec.nwa.nwalib import client_l3 -from networking_nec.nwa.nwalib import client_lbaas -from networking_nec.nwa.nwalib import client_tenant -from networking_nec.nwa.nwalib import nwa_restclient - - -class NwaClient(nwa_restclient.NwaRestClient): - '''Client class of NWA. ''' - - def __init__(self, *args, **kwargs): - super(NwaClient, self).__init__(*args, **kwargs) - - self.tenant = client_tenant.NwaClientTenant(self) - self.l2 = client_l2.NwaClientL2(self) - self.l3 = client_l3.NwaClientL3(self) - self.fwaas = client_fwaas.NwaClientFWaaS(self) - self.lbaas = client_lbaas.NwaClientLBaaS(self) diff --git a/networking_nec/nwa/nwalib/client_fwaas.py b/networking_nec/nwa/nwalib/client_fwaas.py deleted file mode 100644 index 62fc3e0..0000000 --- a/networking_nec/nwa/nwalib/client_fwaas.py +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from debtcollector import removals - - -class NwaClientFWaaS(object): - - def __init__(self, client): - self.client = client - - @removals.remove( - message='It is no longer async. Use setting_fw_policy instead.') - def setting_fw_policy_async(self, tenant_id, fw_name, props): - return self.setting_fw_policy(tenant_id, fw_name, props) - - def setting_fw_policy(self, tenant_id, fw_name, props): - body = { - 'TenantID': tenant_id, - 'DCResourceType': 'TFW_Policy', - 'DCResourceOperation': 'Setting', - 'DeviceInfo': { - 'Type': 'TFW', - 'DeviceName': fw_name, - }, - 'Property': props - } - return self.client.call_workflow( - tenant_id, self.client.post, 'SettingFWPolicy', body) diff --git a/networking_nec/nwa/nwalib/client_l2.py b/networking_nec/nwa/nwalib/client_l2.py deleted file mode 100644 index 235a7e7..0000000 --- a/networking_nec/nwa/nwalib/client_l2.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import log as logging - -from networking_nec._i18n import _LW - - -LOG = logging.getLogger(__name__) - - -class NwaClientL2(object): - - def __init__(self, client): - self.client = client - - # --- Tenant Network --- - - def create_tenant_nw(self, tenant_id, dc_resource_group_name): - body = { - "TenantID": tenant_id, - "CreateNW_DCResourceGroupName": dc_resource_group_name, - 'CreateNW_OperationType': 'CreateTenantNW' - } - return self.client.call_workflow( - tenant_id, self.client.post, 'CreateTenantNW', body - ) - - def delete_tenant_nw(self, tenant_id): - body = { - "TenantID": tenant_id, - } - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteTenantNW', body - ) - - # --- VLan --- - - def create_vlan(self, tenant_id, ipaddr, mask, - vlan_type='BusinessVLAN', openstack_network_id=None): - body = { - 'TenantID': tenant_id, - 'CreateNW_VlanType1': vlan_type, - 'CreateNW_IPSubnetAddress1': ipaddr, - 'CreateNW_IPSubnetMask1': mask - } - if openstack_network_id: - body['CreateNW_VlanLogicalID1'] = openstack_network_id - return self.client.call_workflow( - tenant_id, self.client.post, 'CreateVLAN', body - ) - - def delete_vlan(self, tenant_id, logical_name, vlan_type='BusinessVLAN'): - body = { - 'TenantID': tenant_id, - 'DeleteNW_VlanLogicalName1': logical_name, - 'DeleteNW_VlanType1': vlan_type - } - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteVLAN', body - ) - - # --- General Dev --- - - def create_general_dev(self, tenant_id, dc_resource_group_name, - logical_name, vlan_type='BusinessVLAN', - port_type=None, openstack_network_id=None): - body = { - 'CreateNW_DeviceType1': 'GeneralDev', - 'TenantID': tenant_id, - 'CreateNW_VlanLogicalName1': logical_name, - 'CreateNW_VlanType1': vlan_type, - 'CreateNW_DCResourceGroupName': dc_resource_group_name - } - if logical_name and openstack_network_id: - LOG.warning(_LW('VLAN logical name and id to be specified ' - 'in the exclusive.')) - if openstack_network_id: - body['CreateNW_VlanLogicalID1'] = openstack_network_id - if port_type: - body['CreateNW_PortType1'] = port_type - return self.client.call_workflow( - tenant_id, self.client.post, 'CreateGeneralDev', body - ) - - def delete_general_dev(self, tenant_id, dc_resource_group_name, - logical_name, vlan_type='BusinessVLAN', - port_type=None, openstack_network_id=None): - body = { - 'DeleteNW_DeviceType1': 'GeneralDev', - 'TenantID': tenant_id, - 'DeleteNW_VlanLogicalName1': logical_name, - 'DeleteNW_VlanType1': vlan_type, - 'DeleteNW_DCResourceGroupName': dc_resource_group_name - } - if logical_name and openstack_network_id: - LOG.warning(_LW('VLAN logical name and id to be specified ' - 'in the exclusive.')) - if openstack_network_id: - body['DeleteNW_VlanLogicalID1'] = openstack_network_id - if port_type: - body['DeleteNW_PortType1'] = port_type - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteGeneralDev', body - ) - - # --- Connect Port --- - - def create_connect_port(self, tenant_id, dc_resource_group_name, - logical_name, vlan_type, vlan_id): - body = { - 'CreateNW_DCResourceGroupName': dc_resource_group_name, - 'CreateNW_DeviceType1': 'GeneralDev', - 'CreateNW_OperationType': 'CreateConnectPort', - 'CreateNW_VlanID1': vlan_id, - 'CreateNW_VlanLogicalName1': logical_name, - 'CreateNW_VlanType1': vlan_type, - 'TenantID': tenant_id, - } - return self.client.call_workflow( - tenant_id, self.client.post, 'CreateConnectPort', body - ) - - def delete_connect_port(self, tenant_id, dc_resource_group_name, - logical_name, vlan_type, vlan_id): - body = { - 'DeleteNW_DCResourceGroupName': dc_resource_group_name, - 'DeleteNW_DeviceType1': 'GeneralDev', - 'DeleteNW_OperationType': 'DeleteConnectPort', - 'DeleteNW_VlanID1': vlan_id, - 'DeleteNW_VlanLogicalName1': logical_name, - 'DeleteNW_VlanType1': vlan_type, - 'TenantID': tenant_id, - } - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteConnectPort', body - ) diff --git a/networking_nec/nwa/nwalib/client_l3.py b/networking_nec/nwa/nwalib/client_l3.py deleted file mode 100644 index 4e3a3b9..0000000 --- a/networking_nec/nwa/nwalib/client_l3.py +++ /dev/null @@ -1,117 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from oslo_log import log as logging - -from networking_nec._i18n import _LE - - -LOG = logging.getLogger(__name__) - - -class NwaClientL3(object): - - def __init__(self, client): - self.client = client - - # --- Tenant FW --- - - def create_tenant_fw(self, tenant_id, dc_resource_group_name, - vlan_devaddr, vlan_logical_name, - vlan_type='BusinessVLAN', router_id=None): - body = { - 'CreateNW_DeviceType1': 'TFW', - 'TenantID': tenant_id, - 'CreateNW_Vlan_DeviceAddress1': vlan_devaddr, - 'CreateNW_VlanLogicalName1': vlan_logical_name, - 'CreateNW_VlanType1': vlan_type, - 'CreateNW_DCResourceGroupName': dc_resource_group_name - } - return self.client.call_workflow( - tenant_id, self.client.post, 'CreateTenantFW', body) - - def update_tenant_fw(self, tenant_id, device_name, vlan_devaddr, - vlan_logical_name, vlan_type, - connect=None, router_id=None): - body = { - 'ReconfigNW_DeviceName1': device_name, - 'ReconfigNW_DeviceType1': 'TFW', - 'ReconfigNW_Vlan_DeviceAddress1': vlan_devaddr, - 'ReconfigNW_VlanLogicalName1': vlan_logical_name, - 'ReconfigNW_VlanType1': vlan_type, - 'TenantID': tenant_id - } - if connect: - body['ReconfigNW_Vlan_ConnectDevice1'] = connect - - return self.client.call_workflow( - tenant_id, self.client.post, 'UpdateTenantFW', body) - - def delete_tenant_fw(self, tenant_id, device_name, device_type, - router_id=None): - body = { - 'DeleteNW_DeviceName1': device_name, - 'DeleteNW_DeviceType1': device_type, - 'TenantID': tenant_id - } - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteTenantFW', body) - - # --- Nat --- - - def setting_nat(self, tenant_id, vlan_logical_name, vlan_type, - local_ip, global_ip, dev_name, data=None, router_id=None): - body = { - 'ReconfigNW_DeviceName1': dev_name, - 'ReconfigNW_DeviceType1': 'TFW', - 'ReconfigNW_VlanLogicalName1': vlan_logical_name, - 'ReconfigNW_VlanType1': vlan_type, - 'LocalIP': local_ip, - 'GlobalIP': global_ip, - 'TenantID': tenant_id, - } - return self.client.call_workflow( - tenant_id, self.client.post, 'SettingNAT', body) - - def delete_nat(self, tenant_id, vlan_logical_name, vlan_type, - local_ip, global_ip, dev_name, data=None, router_id=None): - body = { - 'DeleteNW_DeviceName1': dev_name, - 'DeleteNW_DeviceType1': 'TFW', - 'DeleteNW_VlanLogicalName1': vlan_logical_name, - 'DeleteNW_VlanType1': vlan_type, - 'LocalIP': local_ip, - 'GlobalIP': global_ip, - 'TenantID': tenant_id, - } - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteNAT', body) - - def update_nat(self, tenant_id, vlan_logical_name, vlan_type, - local_ip, global_ip, dev_name, data=None, router_id=None): - try: - http_status, rj = self.delete_nat(tenant_id, - vlan_logical_name, vlan_type, - local_ip, global_ip, dev_name, - data=data) - except Exception as e: - LOG.exception(_LE('%s'), e) - http_status = -1 - rj = None - - self.setting_nat(tenant_id, vlan_logical_name, vlan_type, - local_ip, global_ip, dev_name, - data=data, router_id=router_id) - - return http_status, rj diff --git a/networking_nec/nwa/nwalib/client_lbaas.py b/networking_nec/nwa/nwalib/client_lbaas.py deleted file mode 100644 index 7a24794..0000000 --- a/networking_nec/nwa/nwalib/client_lbaas.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import re - - -class NwaClientLBaaS(object): - - def __init__(self, client): - self.client = client - - def create_tenant_lb(self, tenant_id, - dc_resource_group_name, - vlan_logical_name, vlan_type, vif_ipaddr): - body = { - 'CreateNW_DeviceType1': 'LB', - 'TenantID': tenant_id, - 'CreateNW_Vlan_DeviceAddress1': vif_ipaddr, - 'CreateNW_VlanLogicalName1': vlan_logical_name, - 'CreateNW_VlanType1': vlan_type, - 'CreateNW_DCResourceGroupName': dc_resource_group_name - } - return self.client.call_workflow( - tenant_id, self.client.post, 'CreateTenantLB', body) - - def delete_tenant_lb(self, tenant_id, device_name): - body = { - 'DeleteNW_DeviceName1': device_name, - 'DeleteNW_DeviceType1': 'LB', - 'TenantID': tenant_id, - } - return self.client.call_workflow( - tenant_id, self.client.post, 'DeleteTenantLB', body) - - def update_tenant_lbn(self, tenant_id, - device_name, actions): - body = { - 'ReconfigNW_DeviceName1': device_name, - 'ReconfigNW_DeviceType1': 'LB', - 'TenantID': tenant_id - } - for n, a in enumerate(actions): - i = str(n + 1) - if a[0] is not None: - body['ReconfigNW_Vlan_ConnectDevice' + i] = a[0] - lwn = a[1] - body['ReconfigNW_VlanLogicalName' + i] = lwn - if len(a) > 2: - body['ReconfigNW_Vlan_DeviceAddress' + i] = a[2] - if len(a) > 3: - body['ReconfigNW_VlanType' + i] = a[3] - else: - if re.search(lwn, '_PublicVLAN_'): - body['ReconfigNW_VlanType' + i] = 'PublicVLAN' - else: - body['ReconfigNW_VlanType' + i] = 'BusinessVLAN' - - return self.client.call_workflow( - tenant_id, self.client.post, 'UpdateTenantLB', body) - - def setting_lb_policy(self, tenant_id, lb_name, props): - body = { - 'TenantID': tenant_id, - 'DCResourceType': 'LB_Policy', - 'DCResourceOperation': 'Setting', - 'DeviceInfo': { - 'Type': 'LB', - 'DeviceName': lb_name, - }, - 'Property': props - } - return self.client.call_workflow( - tenant_id, self.client.post, 'SettingLBPolicy', body) diff --git a/networking_nec/nwa/nwalib/client_tenant.py b/networking_nec/nwa/nwalib/client_tenant.py deleted file mode 100644 index 1dcca36..0000000 --- a/networking_nec/nwa/nwalib/client_tenant.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from networking_nec.nwa.nwalib import semaphore as nwa_sem - - -class NwaClientTenant(object): - - def __init__(self, client): - self.client = client - - def create_tenant(self, tenant_id): - body = { - 'TenantName': tenant_id, - } - return self.client.post('/umf/tenant/' + tenant_id, body) - - def delete_tenant(self, tenant_id): - status_code, data = self.client.delete('/umf/tenant/' + tenant_id) - if status_code == 200: - nwa_sem.Semaphore.delete_tenant_semaphore(tenant_id) - return status_code, data diff --git a/networking_nec/nwa/nwalib/data_utils.py b/networking_nec/nwa/nwalib/data_utils.py deleted file mode 100644 index 60a84e2..0000000 --- a/networking_nec/nwa/nwalib/data_utils.py +++ /dev/null @@ -1,189 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from networking_nec.nwa.common import constants as nwa_const - -VLAN_OWN_GDV = 'GD' -VLAN_OWN_TFW = 'TFW' - -NWA_DEVICE_MAP = { - nwa_const.NWA_DEVICE_GDV: VLAN_OWN_GDV, - nwa_const.NWA_DEVICE_TFW: VLAN_OWN_TFW, -} - - -def get_network_key(network_id): - return 'NW_' + network_id - - -def get_vlan_key(network_id): - return 'VLAN_' + network_id - - -def get_device_key(device_id): - return 'DEV_' + device_id - - -def get_tfw_device_name(nwa_data, device_id): - return nwa_data['DEV_' + device_id + '_TenantFWName'] - - -def get_device_net_key(device_id, network_id): - return 'DEV_%s_%s' % (device_id, network_id) - - -def get_vlan_logical_name(nwa_data, network_id): - return nwa_data['NW_' + network_id + '_nwa_network_name'] - - -def get_vlan_id(network_id, nwa_data, resultdata): - vlan_key = 'VLAN_' + network_id - if nwa_data[vlan_key + '_CreateVlan'] == '': - return resultdata['VlanID'] - else: - return nwa_data[vlan_key + '_VlanID'] - - -def get_vp_net_vlan_id(nwa_data, network_id, resource_group_name_nw, - device_type): - seg_key = 'VLAN_%s_%s_%s' % (network_id, resource_group_name_nw, - NWA_DEVICE_MAP[device_type]) - return int(nwa_data[seg_key + '_VlanID'], 10) - - -def set_network_data(nwa_data, network_id, nwa_info, logical_name): - nw_net = 'NW_' + network_id - nwa_data[nw_net] = nwa_info['network']['name'] - nwa_data[nw_net + '_network_id'] = network_id - nwa_data[nw_net + '_subnet_id'] = nwa_info['subnet']['id'] - nwa_data[nw_net + '_subnet'] = nwa_info['subnet']['netaddr'] - nwa_data[nw_net + '_nwa_network_name'] = logical_name - - -def strip_network_data(nwa_data, network_id): - nw_net = 'NW_' + network_id - nwa_data.pop(nw_net) - nwa_data.pop(nw_net + '_network_id') - nwa_data.pop(nw_net + '_subnet_id') - nwa_data.pop(nw_net + '_subnet') - nwa_data.pop(nw_net + '_nwa_network_name') - - -def set_vlan_data(nwa_data, network_id, vlan_id): - vp_net = 'VLAN_' + network_id - nwa_data[vp_net] = 'physical_network' - nwa_data[vp_net + '_VlanID'] = vlan_id - nwa_data[vp_net + '_CreateVlan'] = '' - - -def strip_vlan_data(nwa_data, network_id): - vp_net = 'VLAN_' + network_id - nwa_data.pop(vp_net) - nwa_data.pop(vp_net + '_VlanID') - nwa_data.pop(vp_net + '_CreateVlan') - - -def set_gdv_device_data(nwa_data, device_id, nwa_info): - dev_key = 'DEV_%s' % device_id - nwa_data[dev_key] = 'device_id' - nwa_data[dev_key + '_device_owner'] = nwa_info['device']['owner'] - - -def set_tfw_device_data(nwa_data, device_id, tfw_name, nwa_info): - dev_key = 'DEV_%s' % device_id - nwa_data[dev_key] = 'device_id' - nwa_data[dev_key + '_device_owner'] = nwa_info['device']['owner'] - nwa_data[dev_key + '_TenantFWName'] = tfw_name - - -def strip_device_data(nwa_data, device_id): - dev_key = 'DEV_%s' % device_id - nwa_data.pop(dev_key) - nwa_data.pop(dev_key + '_device_owner') - nwa_data.pop(dev_key + '_TenantFWName', None) - - -def set_gdv_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw, nwa_info): - net_key = 'DEV_%s_%s' % (device_id, network_id) - nwa_data[net_key] = nwa_info['network']['name'] - nwa_data[net_key + '_ip_address'] = nwa_info['port']['ip'] - nwa_data[net_key + '_mac_address'] = nwa_info['port']['mac'] - nwa_data[net_key + '_' + resource_group_name_nw] = nwa_const.NWA_DEVICE_GDV - - -def set_tfw_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw, tfw_name, nwa_info): - net_key = 'DEV_%s_%s' % (device_id, network_id) - nwa_data[net_key] = nwa_info['network']['name'] - nwa_data[net_key + '_ip_address'] = nwa_info['port']['ip'] - nwa_data[net_key + '_mac_address'] = nwa_info['port']['mac'] - nwa_data[net_key + '_TenantFWName'] = tfw_name - nwa_data[net_key + '_' + resource_group_name_nw] = nwa_const.NWA_DEVICE_TFW - - -def strip_interface_data(nwa_data, device_id, network_id, - resource_group_name_nw): - net_key = 'DEV_%s_%s' % (device_id, network_id) - nwa_data.pop(net_key) - nwa_data.pop(net_key + '_ip_address') - nwa_data.pop(net_key + '_mac_address') - nwa_data.pop(net_key + '_TenantFWName', None) - nwa_data.pop(net_key + '_' + resource_group_name_nw) - - -def set_vp_net_data(nwa_data, network_id, resource_group_name_nw, device_type, - vlan_id): - seg_key = ('VLAN_%(network_id)s_%(group)s_%(dev_type)s' % - {'network_id': network_id, - 'group': resource_group_name_nw, - 'dev_type': NWA_DEVICE_MAP[device_type]}) - nwa_data[seg_key] = 'physical_network' - nwa_data[seg_key + '_VlanID'] = vlan_id - - -def strip_vp_net_data(nwa_data, network_id, resource_group_name_nw, - device_type): - seg_key = ('VLAN_%(network_id)s_%(group)s_%(dev_type)s' % - {'network_id': network_id, - 'group': resource_group_name_nw, - 'dev_type': NWA_DEVICE_MAP[device_type]}) - nwa_data.pop(seg_key) - nwa_data.pop(seg_key + '_VlanID') - - -def strip_tfw_data_if_exist(nwa_data, device_id, network_id, - resource_group_name_nw): - tfw_key = 'VLAN_%s_%s_TFW_FW_TFW%s' % (network_id, - resource_group_name_nw, - device_id) - if tfw_key in nwa_data: - nwa_data.pop(tfw_key) - - -def set_floatingip_data(nwa_data, floating): - fip_key = 'NAT_' + floating['id'] - nwa_data[fip_key] = floating['device_id'] - nwa_data[fip_key + '_network_id'] = floating['floating_network_id'] - nwa_data[fip_key + '_floating_ip_address'] = \ - floating['floating_ip_address'] - nwa_data[fip_key + '_fixed_ip_address'] = floating['fixed_ip_address'] - - -def strip_floatingip_data(nwa_data, floating): - fip_key = 'NAT_' + floating['id'] - nwa_data.pop(fip_key) - nwa_data.pop(fip_key + '_network_id') - nwa_data.pop(fip_key + '_floating_ip_address') - nwa_data.pop(fip_key + '_fixed_ip_address') diff --git a/networking_nec/nwa/nwalib/exceptions.py b/networking_nec/nwa/nwalib/exceptions.py deleted file mode 100644 index 2f36806..0000000 --- a/networking_nec/nwa/nwalib/exceptions.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - - -class NwaException(Exception): - '''Raised when there is an error in Nwa. ''' - def __init__(self, http_status, errmsg, orgexc=None): - super(NwaException, self).__init__() - self.http_status = http_status - self.errmsg = errmsg - self.orgexc = orgexc - - def __str__(self): - return 'http status: %s, %s' % (self.http_status, self.errmsg) diff --git a/networking_nec/nwa/nwalib/nwa_restclient.py b/networking_nec/nwa/nwalib/nwa_restclient.py deleted file mode 100644 index e76a389..0000000 --- a/networking_nec/nwa/nwalib/nwa_restclient.py +++ /dev/null @@ -1,271 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import base64 -import copy -import hashlib -import hmac -import re - -import eventlet -from oslo_config import cfg -from oslo_log import log as logging -from oslo_serialization import jsonutils -from oslo_utils import encodeutils -import six -from six.moves.urllib import parse as urlparse - -from networking_nec._i18n import _LI, _LW, _LE -from networking_nec.nwa.common import config as nwaconf -from networking_nec.nwa.nwalib import exceptions as nwa_exc -from networking_nec.nwa.nwalib import restclient -from networking_nec.nwa.nwalib import semaphore as nwa_sem -from networking_nec.nwa.nwalib import workflow - - -LOG = logging.getLogger(__name__) - -cfgNWA = nwaconf.cfg.CONF.NWA - -CRLF = '\x0D\x0A' - - -class NwaRestClient(restclient.RestClient): - '''Client class of NWA rest. ''' - - workflow_list_is_loaded = False - - def __init__(self, host=None, port=None, use_ssl=True, auth=None, - access_key_id=None, secret_access_key=None, **kwargs): - load_workflow_list = kwargs.pop('load_workflow_list', True) - if auth is None: - auth = self._define_auth_function(access_key_id, secret_access_key) - if not host or not port: - if not cfgNWA.server_url: - raise cfg.Error("'server_url' or (host, port) " - "must be specified.") - host, port, use_ssl = self._parse_server_url(cfgNWA.server_url) - super(NwaRestClient, self).__init__(host, port, use_ssl, auth, - **kwargs) - self._post_data = None - self.workflow_first_wait = cfg.CONF.NWA.scenario_polling_first_timer - self.workflow_wait_sleep = cfg.CONF.NWA.scenario_polling_timer - self.workflow_retry_count = cfg.CONF.NWA.scenario_polling_count - LOG.info(_LI('NWA init: workflow wait: %(first_wait)ss + ' - '%(wait_sleep)ss x %(retry_count)s times.'), - {'first_wait': self.workflow_first_wait, - 'wait_sleep': self.workflow_wait_sleep, - 'retry_count': self.workflow_retry_count}) - if load_workflow_list and not NwaRestClient.workflow_list_is_loaded: - self.update_workflow_list() - NwaRestClient.workflow_list_is_loaded = True - - def _parse_server_url(self, url): - url_parts = urlparse.urlparse(url) - return (url_parts.hostname, - url_parts.port, - url_parts.scheme == 'https') - - def _define_auth_function(self, access_key_id, secret_access_key): - access_key_id = access_key_id or cfgNWA.access_key_id - secret_access_key = secret_access_key or cfgNWA.secret_access_key - if not access_key_id or not secret_access_key: - # XXX: Don't we need to raise an error? - # raise cfg.Error('access_key_id and secret_access_key must ' - # 'be specified.') - return - - def azure_auth(datestr, path): - signature = hmac.new( - encodeutils.safe_encode(secret_access_key), - encodeutils.safe_encode(datestr + CRLF + path), - hashlib.sha256 - ).digest() - return (encodeutils.safe_encode('SharedKeyLite %s:' - % access_key_id) + - base64.b64encode(signature)) - - return azure_auth - - def workflow_polling_log_post_data(self, url, body): - self._post_data = (url, body) - - def _log_rest_request(self, method, url, body): - name = workflow.NwaWorkflow.name(url) - body_str = '' - if isinstance(body, dict): - body_str = jsonutils.dumps(body, sort_keys=True) - if name: - LOG.info(_LI('NWA workflow: %(name)s %(body)s'), - {'name': name, 'body': body_str}) - else: - LOG.info(_LI('NWA %(method)s %(url)s %(body)s'), - {'method': method, - 'url': self._url(url), - 'body': body_str}) - - def _log_workflow_success(self, data): - name = '' - if self._post_data: - post_url = self._post_data[0] - name = (workflow.NwaWorkflow.name(post_url) or post_url) - LOG.info(_LI("NWA workflow: %(name)s %(workflow)s"), - {'name': name, - 'workflow': jsonutils.dumps(data, indent=4, sort_keys=True)}) - - def _log_workflow_error(self, data): - errno = workflow.NwaWorkflow.get_errno_from_resultdata(data) - if not self._post_data: - return '' - post_url, post_body = self._post_data - if isinstance(post_body, dict): - post_body = jsonutils.dumps(post_body, indent=4, sort_keys=True) - name = (workflow.NwaWorkflow.name(post_url) or post_url) - reason = workflow.NwaWorkflow.strerror(errno) - LOG.error(_LE("NWA workflow: %(name)s reason(%(errno)s)=%(reason)s " - "request=%(request)s, response=%(response)s"), - {'name': name, - 'errno': errno, - 'reason': reason, - 'request': post_body, - 'response': jsonutils.dumps(data, indent=4, sort_keys=True) - }) - - def _log_rest_response(self, status_code, data): - status = '' - progress = '' - if isinstance(data, dict) and data.get('status'): - status = data.get('status') - progress = data.get('progress') - LOG.info(_LI("NWA HTTP %(code)s %(status)s %(progress)s"), - {'code': status_code, - 'status': status, 'progress': progress}) - if status == 'FAILED': - self._log_workflow_error(data) - elif status == 'SUCCEED': - self._log_workflow_success(data) - - def rest_api(self, method, url, body=None): - status_code = 200 - try: - self._log_rest_request(method, url, body) - status_code, data = super(NwaRestClient, - self).rest_api(method, url, body) - self._log_rest_response(status_code, data) - return status_code, data - - except nwa_exc.NwaException as e: - status_code = e.http_status - return status_code, None - - def workflowinstance(self, execution_id): - return self.get('/umf/workflowinstance/' + execution_id) - - def stop_workflowinstance(self, execution_id): - return self.delete('/umf/workflowinstance/' + execution_id) - - def workflow_kick_and_wait(self, call, url, body): - http_status = -1 - rj = None - (http_status, rj) = call(url, body) - - if not isinstance(rj, dict): - return (http_status, None) - - exeid = rj.get('executionid') - if not isinstance(exeid, six.string_types): - LOG.error(_LE('Invalid executin id %s'), exeid) - try: - wait_time = self.workflow_first_wait - eventlet.sleep(wait_time) - for __ in range(self.workflow_retry_count): - (http_status, rw) = self.workflowinstance(exeid) - if not isinstance(rw, dict): - LOG.error( - _LE('NWA workflow: failed %(http_status)s %(body)s'), - {'http_status': http_status, 'body': rw} - ) - return (http_status, None) - if rw.get('status') != 'RUNNING': - LOG.debug('%s', rw) - return (http_status, rw) - eventlet.sleep(wait_time) - wait_time = self.workflow_wait_sleep - LOG.warning(_LW('NWA workflow: retry over. retry count is %s.'), - self.workflow_retry_count) - except Exception as e: - LOG.error(_LE('NWA workflow: %s'), e) - return (http_status, None) - - def call_workflow(self, tenant_id, post, name, body): - url = workflow.NwaWorkflow.path(name) - try: - wkf = nwa_sem.Semaphore.get_tenant_semaphore(tenant_id) - if wkf.sem.locked(): - LOG.info(_LI('NWA sem %s(count)s: %(name)s %(url)s %(body)s'), - {'count': wkf.sem.balance, - 'name': post.__name__, - 'url': url, - 'body': body}) - with wkf.sem: - n = copy.copy(self) - n.workflow_polling_log_post_data(url, body) - http_status, rj = n.workflow_kick_and_wait(post, url, body) - return http_status, rj - except Exception as e: - LOG.exception(_LE('%s'), e) - return -1, None - - def wait_workflow_done(self, thr): - LOG.debug('*** start wait') - thr.wait() - LOG.debug('*** end wait') - - def get_tenant_resource(self, tenant_id): - return self.get('/umf/reserveddcresource/' + tenant_id) - - def get_dc_resource_groups(self, group=None): - if not group: - url = '/umf/dcresource/groups' - else: - url = '/umf/dcresource/groups/' + str(group) - return self.get(url) - - def get_reserved_dc_resource(self, tenant_id): - url = '/umf/reserveddcresource/' + str(tenant_id) - return self.get(url) - - def get_workflow_list(self): - try: - url = '/umf/workflow/list' - return self.get(url) - except Exception as e: - LOG.warning(_LW('The initial worklist is not updated,' - ' using default worklist. (%s)'), e) - return None, None - - def update_workflow_list(self): - __, rj = self.get_workflow_list() - nameid = {} - if isinstance(rj, dict) and rj.get('Workflows'): - def new_nameid(wf): - path = wf.get('Path') - if isinstance(path, six.string_types): - m = re.search(r'\\([a-zA-Z0-9_]+)$', path) - if m: - key = str(m.group(1)) - nameid[key] = str(wf.get('Id')) - for _wf in rj.get('Workflows'): - new_nameid(_wf) - workflow.NwaWorkflow.update_nameid(nameid) diff --git a/networking_nec/nwa/nwalib/restclient.py b/networking_nec/nwa/nwalib/restclient.py deleted file mode 100644 index e77c8fb..0000000 --- a/networking_nec/nwa/nwalib/restclient.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import datetime - -from oslo_log import log as logging -from oslo_serialization import jsonutils -import requests - -from networking_nec._i18n import _, _LI -from networking_nec.nwa.nwalib import exceptions as nwa_exc - - -LOG = logging.getLogger(__name__) - -DATE_HEADER_FORMAT = '%a, %d %b %Y %H:%M:%S GMT' - -UMF_API_VERSION = '2.0.2.1.201502' -OLD_UMF_API_VERSION = '2.0.2.201402' - - -# datetime.datetime.utcnow cannot be mocked. -# It is required to mock utcnow in unit test. -def utcnow(): - return datetime.datetime.utcnow() - - -class RestClient(object): - """A HTTP/HTTPS client for NEC NWA Drivers.""" - - def __init__(self, host=None, port=None, use_ssl=True, auth=None, - umf_api_version=UMF_API_VERSION): - """Creates a new client to some NWA. - - :param host: The host where service resides - :param port: The port where service resides - :param use_ssl: True to use SSL, False to use HTTP - :param: auth: function to generate Authorization header. - """ - self.host = host - self.port = port - self.use_ssl = use_ssl - self.auth = auth - self.umf_api_version = umf_api_version - - LOG.info( - _LI('NWA init: host=%(host)s port=%(port)s use_ssl=%(use_ssl)s ' - 'auth=%(auth)s'), - {'host': self.host, 'port': self.port, 'use_ssl': self.use_ssl, - 'auth': self.auth} - ) - LOG.info(_LI('NWA init: umf api version: %s'), - self.umf_api_version) - - def _url(self, path): - protocol = "http" - if self.use_ssl: - protocol = "https" - return '%s://%s:%s%s' % (protocol, self.host, self.port, path) - - def _make_headers(self, path): - datestr = utcnow().strftime(DATE_HEADER_FORMAT) - headers = { - # XXX: If auth is None, RestClient will be broken. - 'Authorization': self.auth(datestr, path), - 'Content-Type': 'application/json', - 'Date': datestr, - 'X-UMF-API-Version': self.umf_api_version - } - return headers - - def _send_receive(self, method, path, body=None): - scheme = "http" - if self.use_ssl: - scheme = "https" - - url = "%s://%s:%d%s" % (scheme, self.host, int(self.port), path) - headers = self._make_headers(path) - LOG.debug('NWA HTTP Headers %s', headers) - res = requests.request(method, url, data=body, headers=headers, - verify=False, proxies={'no': 'pass'}) - return res - - def rest_api(self, method, url, body=None): - if isinstance(body, dict): - body = jsonutils.dumps(body, indent=4, sort_keys=True) - - LOG.debug("NWA %(method)s %(host)s:%(port)s%(url)s body=%(body)s", - {'method': method, 'host': self.host, 'port': self.port, - 'url': url, 'body': body}) - - status_code = -1 - try: - res = self._send_receive(method, url, body) - except requests.exceptions.RequestException as e: - msg = _("NWA Failed to connect %(host)s:%(port)s: %(reason)s") - msg_params = {'host': self.host, - 'port': self.port, - 'reason': e} - LOG.error(msg, msg_params) - raise nwa_exc.NwaException(status_code, msg % msg_params, e) - - data = res.text - LOG.debug("NWA returns: httpStatus=%(status)s body=%(data)s", - {'status': res.status_code, - 'data': data}) - try: - data = jsonutils.loads(data) - except (ValueError, TypeError): - pass - status_code = int(res.status_code) - if 200 <= status_code and status_code <= 209: - return (status_code, data) - else: - msg = _("NWA failed: %(method)s %(host)s:%(port)s%(url)s " - "(HTTP/1.1 %(status_code)s %(reason)s) body=%(data)s") - msg_params = {'method': method, - 'host': self.host, - 'port': self.port, - 'url': url, - 'status_code': res.status_code, - 'reason': res.reason, - 'data': data} - LOG.warning(msg, msg_params) - raise nwa_exc.NwaException(status_code, msg % msg_params) - - def get(self, url): - return self.rest_api("GET", url) - - def post(self, url, body=None): - return self.rest_api("POST", url, body=body) - - def put(self, url, body=None): - return self.rest_api("PUT", url, body=body) - - def delete(self, url): - return self.rest_api("DELETE", url) diff --git a/networking_nec/nwa/nwalib/semaphore.py b/networking_nec/nwa/nwalib/semaphore.py deleted file mode 100644 index 0e39cdd..0000000 --- a/networking_nec/nwa/nwalib/semaphore.py +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import eventlet -from oslo_log import log as logging -import six - -from networking_nec._i18n import _, _LI - - -LOG = logging.getLogger(__name__) - - -class Thread(object): - def __init__(self, thread): - self.thread = thread - - def stop(self): - self.thread.kill() - - def wait(self): - return self.thread.wait() - - -class Semaphore(object): - lock = eventlet.semaphore.Semaphore(1) - tenants = {} - - @classmethod - def get_tenant_semaphore(cls, tenant_id): - if not isinstance(tenant_id, six.string_types) or tenant_id == '': - raise TypeError(_('%s is not a string') % tenant_id) - with Semaphore.lock: - if tenant_id not in Semaphore.tenants: - LOG.info(_LI('create semaphore for %s'), tenant_id) - Semaphore.tenants[tenant_id] = Semaphore() - return Semaphore.tenants[tenant_id] - - @classmethod - def delete_tenant_semaphore(cls, tenant_id): - with Semaphore.lock: - if tenant_id in Semaphore.tenants: - LOG.info(_LI('delete semaphore for %s'), tenant_id) - del Semaphore.tenants[tenant_id] - - def __init__(self): - self._sem = eventlet.semaphore.Semaphore(1) - - @property - def sem(self): - return self._sem diff --git a/networking_nec/nwa/nwalib/workflow.py b/networking_nec/nwa/nwalib/workflow.py deleted file mode 100644 index aceeaf1..0000000 --- a/networking_nec/nwa/nwalib/workflow.py +++ /dev/null @@ -1,178 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import re - -import six - - -class NwaWorkflow(object): - '''Workflow definition of NWA. ''' - _path_prefix = '/umf/workflow/' - _nameid_initialized = False - _nameid = { - 'CreateTenantNW': '40030001', - 'DeleteTenantNW': '40030016', - 'CreateVLAN': '40030002', - 'DeleteVLAN': '40030018', - 'CreateGeneralDev': '40030021', - 'DeleteGeneralDev': '40030022', - 'CreateTenantFW': '40030019', - 'UpdateTenantFW': '40030009', - 'DeleteTenantFW': '40030020', - 'SettingNAT': '40030005', - 'DeleteNAT': '40030011', - 'SettingFWPolicy': '40030081', - 'SettingLBPolicy': '40030091', - 'CreateTenantLB': '40030092', - 'UpdateTenantLB': '40030093', - 'DeleteTenantLB': '40030094', - 'CreateConnectPort': '50000001', - 'DeleteConnectPort': '50000002', - } - _errno = { - '1': 'Unknown parent node', - '2': 'Already exists', - '3': 'Resources are insufficient', - '4': 'Unknown node', - '5': 'Can not access the file', - '6': 'Unknown parameters', - '7': 'Undefined parameters', - '8': 'Permission error', - '9': 'It is not possible to remove because it is in use', - '10': 'An error occurred while deleting the node', - '11': 'Execution environment is invalid', - '31': 'Specified IP subnet does not exist', - '32': 'Specified IP address does not exist', - '33': 'Can not allocate IP subnet to be paid out', - '34': 'IP subnet will not exceed the threshold', - '101': 'An unknown error has occurred', - '102': 'An internal error has occurred', - '103': 'Failed to connect to CMDB', - '104': 'Out of memory', - '105': 'An error occurred in the select process to the CMDB', - '106': 'An error occurred in the update process to the CMDB', - '107': 'An error occurred in the insert process to the CMDB', - '108': 'Input parameter is invalid', - '109': 'An error occurred in the file processing', - '110': 'An error occurred in the delete process to the CMDB', - '201': 'There is no free VLAN ID', - '202': 'Exceeded the threshold of VLAN', - '203': 'Exceeded the threshold ot Tenant equipment', - '204': 'Resource group is not specified in the input', - '205': 'Tenant-ID is not specified in the input', - '206': 'Tenant-Network is already created', - '207': 'There is no available devices', - '208': 'IP address depletion for assignment of LB', - '209': 'The device in the cluster group is 0 or 2 or more', - '210': 'The device in the cluster group is 0', - '211': 'There is no specified resource group', - '212': 'There is no character "/" in the resource group name', - '213': 'Tenant-FW is not specified one', - '214': 'Tenant-FW is specified two or more', - '215': 'Can not be extended because there is no PFS', - '216': 'Logical NW name is not specified', - '217': 'There is no Registered SSL-VPN equipment', - '218': 'Tenant network is not yet created', - '219': 'There is no free LoadBalancer', - '220': 'Can not get the physical server uuid', - '221': 'There is no deletion of VLAN', - '222': 'Tenant ID in use is still exists', - '223': 'Tenant-FW not found', - '224': 'There is no specified device name', - '225': 'Can not get the information of tenant vlan', - '226': 'There is no specified logical NW', - '227': 'Can not get the device information of the tenant in use', - '228': 'For updated is in use, it could not be updated', - '229': 'For deletion is in use, it could not be deleted', - '230': 'Exceeded the threshold', - '231': 'Exceeded the allocation possible number', - '232': 'Exceeded the allocation range', - '233': 'Authentication setting is incorrect', - '234': 'Usable IP address range setting of is invalid', - '235': 'IP address specified is invalid', - '236': 'There is no available for allocation Tenant FW', - '237': 'IP address depletion for assignment of FW', - '238': 'IP address is invalid', - '239': 'Can not set the number of records to zero', - '240': 'The specification does not include a payout already IP subnet', - '241': 'Not specified LogicalPort under the same controller or domain', - '242': 'IP address depletion for assignment of SSL', - '243': 'IP address is invalid', - '244': 'The type of controller is invalid', - '245': 'Device or VDOM name is invalid specified', - '246': 'Exceeds the upper limit of naming convention', - '251': 'In the same tenant, scenario there are still concurrent or ' - 'reservation ID', - '252': '(unused)', - '253': 'The preceding scenario, can not be reserved', - '254': 'Can not get the reserved id because of the preceding scenario', - '298': 'Resources are insufficient', - '299': 'Unknown error', - } - - @staticmethod - def init(name): - pass # pragma: no cover - - @staticmethod - def path(name): - """Returns path of workflow. - - :param name: The name of workflow. - """ - return '%s%s/execute' % (NwaWorkflow._path_prefix, - NwaWorkflow._nameid[name]) - - @staticmethod - def name(path): - """Returns name of workflow. - - :param name: The name of workflow. - """ - wid = path[len(NwaWorkflow._path_prefix):-len('/execute')] - for (name, _id) in NwaWorkflow._nameid.items(): - if _id == wid: - return name - return None - - @staticmethod - def strerror(errno): - """Returns error name of errno. - - :param errno: The number of error. - """ - return NwaWorkflow._errno.get(errno) - - @staticmethod - def get_errno_from_resultdata(data): - resultdata = data.get('resultdata') - if resultdata: - errmsg = resultdata.get('ErrorMessage') - if isinstance(errmsg, six.string_types): - m = re.search(r'ErrorNumber=(\d+)', errmsg) - if m: - return m.group(1) - m = re.search(r'ReservationErrorCode = (\d+)', errmsg, re.M) - if m: - return m.group(1) - return None - - @staticmethod - def update_nameid(new_nameid): - if NwaWorkflow._nameid_initialized: - return - if new_nameid: - NwaWorkflow._nameid = new_nameid - NwaWorkflow._nameid_initialized = True diff --git a/networking_nec/tests/__init__.py b/networking_nec/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/__init__.py b/networking_nec/tests/unit/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/__init__.py b/networking_nec/tests/unit/nwa/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/agent/__init__.py b/networking_nec/tests/unit/nwa/agent/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/agent/base.py b/networking_nec/tests/unit/nwa/agent/base.py deleted file mode 100644 index ec93a95..0000000 --- a/networking_nec/tests/unit/nwa/agent/base.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.common import rpc -from neutron.tests import base -from oslo_config import cfg - -from networking_nec.nwa.agent import nwa_agent - - -def _init_nwa_client_patch(mocked_nwacli): - succeed = (200, { - 'status': 'SUCCEED', - 'resultdata': { - 'LogicalNWName': 'LNW_BusinessVLAN_4000', - 'TenantFWName': 'T1', - 'VlanID': '4000', - } - }) - mocked_nwacli.tenant.create_tenant.return_value = succeed - mocked_nwacli.tenant.delete_tenant.return_value = succeed - - mocked_nwacli.l2.create_general_dev.return_value = succeed - mocked_nwacli.l2.create_tenant_nw.return_value = succeed - mocked_nwacli.l2.create_vlan.return_value = succeed - mocked_nwacli.l2.create_connect_port.return_value = succeed - - mocked_nwacli.l2.delete_general_dev.return_value = succeed - mocked_nwacli.l2.delete_tenant_nw.return_value = succeed - mocked_nwacli.l2.delete_vlan.return_value = succeed - mocked_nwacli.l2.delete_connect_port.return_value = succeed - - -class TestNWAAgentBase(base.BaseTestCase): - - @mock.patch('oslo_service.loopingcall.FixedIntervalLoopingCall') - @mock.patch('neutron.common.rpc.Connection.consume_in_threads') - @mock.patch('neutron.common.rpc.create_connection') - @mock.patch('neutron.agent.rpc.PluginReportStateAPI') - @mock.patch('neutron.common.rpc.get_client') - def setUp(self, f1, f2, f3, f4, f5): - super(TestNWAAgentBase, self).setUp() - - cli = mock.patch('networking_nec.nwa.nwalib.client.NwaClient').start() - self.nwacli = cli.return_value - _init_nwa_client_patch(self.nwacli) - - self.agent = nwa_agent.NECNWANeutronAgent(10) - rpc.init(cfg.ConfigOpts()) diff --git a/networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info.json b/networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info.json deleted file mode 100644 index 8e03aa5..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "device": { - "id": "6b34210c-bd74-47f0-8dc3-3bad9bc333c3", - "owner": "network:router_interface" - }, - "network": { - "id": "546a8551-5c2b-4050-a769-cc3c962fc5cf", - "name": "net100", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "physical_network": "OpenStack/DC1/APP", - "port": { - "id": "5174b4d2-f4dc-4292-9d9e-7862f885abdf", - "ip": "192.168.100.1", - "mac": "fa:16:3e:45:98:7d" - }, - "resource_group": "OpenStack/DC1/APP", - "resource_group_name": "OpenStack/DC1", - "resource_group_name_nw": "OpenStack/DC1", - "subnet": { - "id": "7dabadaa-06fc-45fb-af0b-33384cf291c4", - "mask": "24", - "netaddr": "192.168.100.0" - } -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info_2.json b/networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info_2.json deleted file mode 100644 index 36b15bc..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/add_router_interface_nwa_info_2.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "device": { - "id": "6b34210c-bd74-47f0-8dc3-3bad9bc333c3", - "owner": "network:router_interface" - }, - "network": { - "id": "b2246c56-d465-49c7-a332-f329aa524277", - "name": "net101", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "physical_network": "OpenStack/DC1/APP", - "port": { - "id": "254c3a42-b3aa-4083-9b7b-2e4c62b2ffbb", - "ip": "192.168.101.1", - "mac": "fa:16:3e:34:9a:c9" - }, - "resource_group": "OpenStack/DC1/APP", - "resource_group_name": "OpenStack/DC1", - "resource_group_name_nw": "OpenStack/DC1", - "subnet": { - "id": "ec3d84a5-ce49-48ee-a041-a7b9c9867899", - "mask": "24", - "netaddr": "192.168.101.0" - } -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info.json b/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info.json deleted file mode 100644 index 578b72e..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "device": { - "id": "36509c40-58e0-4293-8b16-48b409959b8f", - "owner": "compute:DC1_KVM" - }, - "network": { - "id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "name": "pj1-net100", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "physical_network": "OpenStack/DC1/APP", - "port": { - "id": "c61583dd-b52b-4bd7-b586-a6b33780090f", - "ip": "192.168.200.132", - "mac": "fa:16:3e:a6:1d:00" - }, - "resource_group": "OpenStack/DC1/APP", - "resource_group_name": "OpenStack/DC1/APP", - "resource_group_name_nw": "OpenStack/DC1/APP", - "subnet": { - "id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "mask": "24", - "netaddr": "192.168.200.0" - }, - "tenant_id": "844eb55f21e84a289e9c22098d387e5d" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info_2.json b/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info_2.json deleted file mode 100644 index 578b72e..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_nwa_info_2.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "device": { - "id": "36509c40-58e0-4293-8b16-48b409959b8f", - "owner": "compute:DC1_KVM" - }, - "network": { - "id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "name": "pj1-net100", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "physical_network": "OpenStack/DC1/APP", - "port": { - "id": "c61583dd-b52b-4bd7-b586-a6b33780090f", - "ip": "192.168.200.132", - "mac": "fa:16:3e:a6:1d:00" - }, - "resource_group": "OpenStack/DC1/APP", - "resource_group_name": "OpenStack/DC1/APP", - "resource_group_name_nw": "OpenStack/DC1/APP", - "subnet": { - "id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "mask": "24", - "netaddr": "192.168.200.0" - }, - "tenant_id": "844eb55f21e84a289e9c22098d387e5d" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_result.json b/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_result.json deleted file mode 100644 index 86436e9..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/create_general_dev_result.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "CreateNW_PortType1": "", - "DCResourceReserveID": "1", - "ErrorMessage": "", - "NWAResult": "No result log\r\n", - "ResourceGroupName": "OpenStack/DC1/APP", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "VlanID": "200", - "VlanLoopCounter": "1" - }, - "status": "SUCCESS" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/create_tenant_nw_result.json b/networking_nec/tests/unit/nwa/agent/test_data/create_tenant_nw_result.json deleted file mode 100644 index eaa05c0..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/create_tenant_nw_result.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "AutoRecovery": "0", - "BackEndFWInfo": "FortiGate", - "DCResourceReserveID": "1", - "DCResourceReserveID_Delete": "", - "ErrorMessage": "", - "InJsonFileName": "", - "ManagementLogicalNWName": "LNW_ManagementVLAN_88", - "ManagementVlanFwIpAddress": "100.64.0.254", - "ManagementVlanID": "1", - "ManagementVlanIPSubnet": "100.64.0.0", - "ManagementVlanSubnetMask": "255.255.255.0", - "OutJsonFileName": "", - "ResourceGroupName": "OpenStack/DC1/APP", - "TenantFWAccessInfo": "", - "TenantFWInfo": "", - "TenantFWName": "", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "TenantLogicalNWName": "LNW_TenantVLAN_89", - "TenantVlanFwIpAddress": "", - "TenantVlanID": "", - "TenantVlanIPSubnet": "100.64.1.0", - "TenantVlanSubnetMask": "255.255.255.0" - }, - "status": "SUCCEED" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/create_vlan_result.json b/networking_nec/tests/unit/nwa/agent/test_data/create_vlan_result.json deleted file mode 100644 index b4f6587..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/create_vlan_result.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "AutoRecovery": "0", - "BackEndFWInfo": "", - "DCResourceReserveID": "1", - "DCResourceReserveID_Delete": "", - "ErrorMessage": "", - "InJsonFileName": "", - "LogicalNWName": "LNW_BusinessVLAN_100", - "OutJsonFileName": "", - "ResourceGroupName": "", - "RouterInfo": "", - "TenantFWAccessInfo": "", - "TenantFWInfo": "", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "VlanFwIpAddress": "", - "VlanID": "", - "VlanIPSubnet": "192.168.100.0", - "VlanSubnetMask": "255.255.255.0" - }, - "status": "SUCCEED" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_nwa_info.json b/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_nwa_info.json deleted file mode 100644 index 2c9abf7..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_nwa_info.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "36509c40-58e0-4293-8b16-48b409959b8f", - "owner": "compute:DC1_KVM" - }, - "network": { - "id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "name": "pj1-net100", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "physical_network": "OpenStack/DC1/APP", - "port": { - "id": "68ef8ee1-277b-4570-cb28-ad514a7699e7", - "ip": "192.168.200.161", - "mac": "fa:16:3e:bc:18:00" - }, - "resource_group": "OpenStack/DC1/APP", - "resource_group_name": "OpenStack/DC1/APP", - "subnet": { - "id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "mask": "24", - "netaddr": "192.168.200.0" - }, - "tenant_id": "844eb55f21e84a289e9c22098d387e5d" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result.json b/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result.json deleted file mode 100644 index bb799f9..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "DCResourceReserveID": "1", - "ErrorMessage": "", - "NWAResult": "No result log\r\n", - "ResourceGroupName": "OpenStack/DC1/APP", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "UNC_LoopCounter": "1", - "VlanLoopCounter": "0" - }, - "status": "SUCCEED" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result_fail.json b/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result_fail.json deleted file mode 100644 index 4f12c02..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/delete_general_dev_result_fail.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "DCResourceReserveID": "1", - "ErrorMessage": "", - "NWAResult": "No result log\r\n", - "ResourceGroupName": "OpenStack/DC1/APP", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "UNC_LoopCounter": "1", - "VlanLoopCounter": "0" - }, - "status": "FAILED" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/delete_tenant_nw_result.json b/networking_nec/tests/unit/nwa/agent/test_data/delete_tenant_nw_result.json deleted file mode 100644 index 2b6d100..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/delete_tenant_nw_result.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "DCResourceReserveID": "1", - "DevType": "", - "ErrorMessage": "", - "GUID": "", - "LogicalNWName_Del": "LNW_TenantVLAN_89", - "ManagerName": "", - "Mode": "", - "NWAResult": "No result log\r\n", - "NumOfTenantNWDev": "", - "ResourceGroupName": "Common/App/Pod3", - "SSLAuthFlag": "", - "Section": "", - "TFWAuthFlag": "", - "TFWCount": "", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "UNC_LoopCounter": "1", - "VlanID_Del": "5", - "VlanLoopCounter": "0", - "VlanType": "" - }, - "status": "SUCCEED" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/delete_vlan_result.json b/networking_nec/tests/unit/nwa/agent/test_data/delete_vlan_result.json deleted file mode 100644 index 7860a61..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/delete_vlan_result.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "progress": 100, - "resultdata": { - "DCResourceReserveID": "1", - "ErrorMessage": "", - "NWAResult": "No result log\r\n", - "TenantID": "DC1_844eb55f21e84a289e9c22098d387e5d", - "UNC_LoopCounter": "1", - "VlanLoopCounter": "0" - }, - "status": "SUCCEED" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/expected_proxy_create_vlan_succeed1.json b/networking_nec/tests/unit/nwa/agent/test_data/expected_proxy_create_vlan_succeed1.json deleted file mode 100644 index 0883d5e..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/expected_proxy_create_vlan_succeed1.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf": "net100", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_network_id": "546a8551-5c2b-4050-a769-cc3c962fc5cf", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_subnet": "192.168.100.0", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_subnet_id": "7dabadaa-06fc-45fb-af0b-33384cf291c4", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf": "physical_network", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_CreateVlan": "", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_VlanID": "300" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_check_segment.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_check_segment.json deleted file mode 100644 index 3b8e2ae..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_check_segment.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "CreateTenantNW": "1", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1": "device_id", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_TenantFWName": "TFW3", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "TenantFW", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TenantFWName": "TFW3", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_a94fd0fc-2282-4092-9485-b0f438b0f6c4_ip_address": "192.168.200.1", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_a94fd0fc-2282-4092-9485-b0f438b0f6c4_mac_address": "fa:16:3e:17:41:b4", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_device_owner": "network:router_interface", - "DEV_843bc108-2f17-4be4-b9cb-44e00abe78d1_physical_network": "OpenStack/DC1/APP", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_network_id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_nwa_network_name": "LNW_BusinessVLAN_103", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet": "192.168.200.0", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet_id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "physical_network", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_CreateVlan": "CreateVlan", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_FW_TFW843bc108-2f17-4be4-b9cb-44e00abe78d1": "connected", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_VlanID": "37", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_ex1.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_ex1.json deleted file mode 100644 index af9bae1..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_ex1.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99": "device_id", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_0ed65870-9acb-48ce-8c0b-e803d527a9d2": "net100", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_0ed65870-9acb-48ce-8c0b-e803d527a9d2_TYPE": "TenantFW", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_0ed65870-9acb-48ce-8c0b-e803d527a9d2_TenantFWName": "TFW8", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_0ed65870-9acb-48ce-8c0b-e803d527a9d2_ip_address": "192.168.100.1", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_0ed65870-9acb-48ce-8c0b-e803d527a9d2_mac_address": "fa:16:3e:97:4f:d4", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_TenantFWName": "TFW8", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_device_owner": "network:router_interface", - "DEV_4b18c7ba-1370-410e-af4c-8578fbb3ab99_physical_network": "OpenStack/DC1/APP", - "NWA_tenant_id": "DC02_844eb55f21e84a289e9c22098d387e5d", - "NW_0ed65870-9acb-48ce-8c0b-e803d527a9d2": "net100", - "NW_0ed65870-9acb-48ce-8c0b-e803d527a9d2_network_id": "0ed65870-9acb-48ce-8c0b-e803d527a9d2", - "NW_0ed65870-9acb-48ce-8c0b-e803d527a9d2_nwa_network_name": "LNW_BusinessVLAN_108", - "NW_0ed65870-9acb-48ce-8c0b-e803d527a9d2_subnet": "192.168.100.0", - "NW_0ed65870-9acb-48ce-8c0b-e803d527a9d2_subnet_id": "df2a7b8a-e027-49ab-bf84-ade82a3c096c", - "VLAN_0ed65870-9acb-48ce-8c0b-e803d527a9d2_OpenStack/DC1/APP": "physical_network", - "VLAN_0ed65870-9acb-48ce-8c0b-e803d527a9d2_OpenStack/DC1/APP_CreateVlan": "CreateVlan", - "VLAN_0ed65870-9acb-48ce-8c0b-e803d527a9d2_OpenStack/DC1/APP_FW_TFW4b18c7ba-1370-410e-af4c-8578fbb3ab99": "connected", - "VLAN_0ed65870-9acb-48ce-8c0b-e803d527a9d2_OpenStack/DC1/APP_VlanID": "53" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed2.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed2.json deleted file mode 100644 index feac0b8..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed2.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "device_id", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1": "GeneralDev", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.1", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:76:ab:0e", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_device_owner": "network:dhcp", - "NWA_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_network_id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet": "192.168.0.0", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet_id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_CreateVlan": "", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD_VlanID": "49", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed3.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed3.json deleted file mode 100644 index feac0b8..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_create_general_dev_succeed3.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "device_id", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1": "GeneralDev", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.1", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:76:ab:0e", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_device_owner": "network:dhcp", - "NWA_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_network_id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet": "192.168.0.0", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet_id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_CreateVlan": "", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD_VlanID": "49", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed1.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed1.json deleted file mode 100644 index fe9410e..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed1.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "device_id", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1": "GeneralDev", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.1", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:76:ab:0e", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_device_owner": "network:dhcp", - "NWA_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_network_id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet": "192.168.0.0", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet_id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_CreateVlan": "", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD_VlanID": "52", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed2.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed2.json deleted file mode 100644 index 18cf090..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed2.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21": "device_id", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1": "GeneralDev", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.3", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:5c:3f:c2", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_device_owner": "compute:DC01_KVM02_ZONE02", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "device_id", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1": "GeneralDev", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.1", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:76:ab:0e", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_device_owner": "network:dhcp", - "NWA_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_network_id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet": "192.168.0.0", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet_id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_CreateVlan": "", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD_VlanID": "49", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed3.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed3.json deleted file mode 100644 index 501a252..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_general_dev_succeed3.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21": "device_id", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA2": "GeneralDev", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.3", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:5c:3f:c2", - "DEV_18972752-f0f4-4cf7-b185-971ff6539d21_device_owner": "compute:DC01_KVM02_ZONE02", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "device_id", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1": "GeneralDev", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_ip_address": "192.168.0.1", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_mac_address": "fa:16:3e:76:ab:0e", - "DEV_dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_device_owner": "network:dhcp", - "NWA_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "net01", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_network_id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet": "192.168.0.0", - "NW_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_subnet_id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_CreateVlan": "", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA1_GD_VlanID": "49", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA2_GD": "physical_network", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_OpenStack/DC/HA2_GD_VlanID": "53", - "VLAN_0f17fa8f-40fe-43bd-8573-1a1e1bfb699d_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_vlan_succeed1.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_vlan_succeed1.json deleted file mode 100644 index 232bacc..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_delete_vlan_succeed1.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "CreateTenant": "1", - "CreateTenantNW": true, - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3": "device_id", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_546a8551-5c2b-4050-a769-cc3c962fc5cf": "net100", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_546a8551-5c2b-4050-a769-cc3c962fc5cf_TYPE": "TenantFW", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_546a8551-5c2b-4050-a769-cc3c962fc5cf_TenantFWName": "TFW27", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_546a8551-5c2b-4050-a769-cc3c962fc5cf_ip_address": "192.168.100.1", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_546a8551-5c2b-4050-a769-cc3c962fc5cf_mac_address": "fa:16:3e:04:d3:28", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_TenantFWName": "TFW27", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_device_owner": "network:router_interface", - "DEV_6b34210c-bd74-47f0-8dc3-3bad9bc333c3_physical_network": "OpenStack/DC1/APP", - "NWA_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf": "net100", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_network_id": "546a8551-5c2b-4050-a769-cc3c962fc5cf", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_nwa_network_name": "LNW_BusinessVLAN_120", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_subnet": "192.168.100.0", - "NW_546a8551-5c2b-4050-a769-cc3c962fc5cf_subnet_id": "7dabadaa-06fc-45fb-af0b-33384cf291c4", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf": "physical_network", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_CreateVlan": "", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_OpenStack/DC1/APP": "physical_network", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_OpenStack/DC1/APP_CreateVlan": "CreateVlan", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_OpenStack/DC1/APP_FW_TFW6b34210c-bd74-47f0-8dc3-3bad9bc333c3": "connected", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_OpenStack/DC1/APP_VlanID": "62", - "VLAN_546a8551-5c2b-4050-a769-cc3c962fc5cf_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_get_resource_group_name.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_get_resource_group_name.json deleted file mode 100644 index 0070a17..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_get_resource_group_name.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "CreateTenant": true, - "CreateTenantNW": true, - "DEV_dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733": "device_id", - "DEV_dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733_315414a5-8d06-4d8e-8932-6f73665e5733": "LNetA", - "DEV_dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733_315414a5-8d06-4d8e-8932-6f73665e5733_OpenStack/DC/HA1": "GeneralDev", - "DEV_dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733_315414a5-8d06-4d8e-8932-6f73665e5733_ip_address": "192.168.1.1", - "DEV_dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733_315414a5-8d06-4d8e-8932-6f73665e5733_mac_address": "fa:16:3e:71:5c:2c", - "DEV_dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733_device_owner": "network:dhcp", - "NWA_tenant_id": "T01DC7483b391c2c647c59097240d59e705d4", - "NW_315414a5-8d06-4d8e-8932-6f73665e5733": "LNetA", - "NW_315414a5-8d06-4d8e-8932-6f73665e5733_network_id": "315414a5-8d06-4d8e-8932-6f73665e5733", - "NW_315414a5-8d06-4d8e-8932-6f73665e5733_nwa_network_name": "LNW_BusinessVLAN_448", - "NW_315414a5-8d06-4d8e-8932-6f73665e5733_subnet": "192.168.201.0", - "NW_315414a5-8d06-4d8e-8932-6f73665e5733_subnet_id": "44345c6f-f597-48c7-b97b-a0d8df39059b", - "VLAN_315414a5-8d06-4d8e-8932-6f73665e5733": "physical_network", - "VLAN_315414a5-8d06-4d8e-8932-6f73665e5733_CreateVlan": "", - "VLAN_315414a5-8d06-4d8e-8932-6f73665e5733_OpenStack/DC/HA1_GD": "physical_network", - "VLAN_315414a5-8d06-4d8e-8932-6f73665e5733_OpenStack/DC/HA1_GD_VlanID": "685", - "VLAN_315414a5-8d06-4d8e-8932-6f73665e5733_VlanID": "" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_one_general_dev.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_one_general_dev.json deleted file mode 100644 index 361778a..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_one_general_dev.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_36509c40-58e0-4293-8b16-48b409959b8f": "device_id", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "GeneralDev", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_ip_address": "192.168.200.132", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_mac_address": "fa:16:3e:a6:1d:00", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_device_owner": "compute:DC1_KVM", - "NWA_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_network_id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet": "192.168.200.0", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet_id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "physical_network", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD": "connected", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD_VlanID": "4000", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_VlanID": "38", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_general_dev.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_general_dev.json deleted file mode 100644 index 0bdb0c4..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_general_dev.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_1547cdd1-5fcc-437e-b2fb-30b0021a0054": "device_id", - "DEV_1547cdd1-5fcc-437e-b2fb-30b0021a0054_device_owner": "compute:DC1_KVM", - "DEV_1547cdd1-5fcc-437e-b2fb-30b0021a0054_f058200f-8fa9-446e-a9d0-86aed2d25a73": "pj1-net101", - "DEV_1547cdd1-5fcc-437e-b2fb-30b0021a0054_f058200f-8fa9-446e-a9d0-86aed2d25a73_TYPE": "GeneralDev", - "DEV_1547cdd1-5fcc-437e-b2fb-30b0021a0054_f058200f-8fa9-446e-a9d0-86aed2d25a73_ip_address": "192.168.100.27", - "DEV_1547cdd1-5fcc-437e-b2fb-30b0021a0054_f058200f-8fa9-446e-a9d0-86aed2d25a73_mac_address": "fa:16:3e:9b:b0:de", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f": "device_id", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "GeneralDev", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_ip_address": "192.168.200.132", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_mac_address": "fa:16:3e:a6:1d:00", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_device_owner": "compute:DC1_KVM", - "NWA_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_network_id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet": "192.168.200.0", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet_id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "NW_f058200f-8fa9-446e-a9d0-86aed2d25a73": "pj1-net101", - "NW_f058200f-8fa9-446e-a9d0-86aed2d25a73_network_id": "f058200f-8fa9-446e-a9d0-86aed2d25a73", - "NW_f058200f-8fa9-446e-a9d0-86aed2d25a73_nwa_network_name": "LNW_BusinessVLAN_107", - "NW_f058200f-8fa9-446e-a9d0-86aed2d25a73_subnet": "192.168.100.0", - "NW_f058200f-8fa9-446e-a9d0-86aed2d25a73_subnet_id": "292af468-18d7-4212-abc5-d55f4ffff656", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "physical_network", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD": "connected", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD_VlanID": "4000", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_VlanID": "38", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_VlanID": "4000", - "VLAN_f058200f-8fa9-446e-a9d0-86aed2d25a73_OpenStack/DC1/APP": "physical_network", - "VLAN_f058200f-8fa9-446e-a9d0-86aed2d25a73_OpenStack/DC1/APP_CreateVlan": "CreateVlan", - "VLAN_f058200f-8fa9-446e-a9d0-86aed2d25a73_OpenStack/DC1/APP_VlanID": "45" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev.json deleted file mode 100644 index 98faf34..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789": "device_id", - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "GeneralDev", - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789_a94fd0fc-2282-4092-9485-b0f438b0f6c4_ip_address": "192.168.200.133", - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789_a94fd0fc-2282-4092-9485-b0f438b0f6c4_mac_address": "fa:16:3e:bc:18:00", - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789_device_owner": "compute:DC1_KVM", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f": "device_id", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "GeneralDev", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_ip_address": "192.168.200.132", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_mac_address": "fa:16:3e:a6:1d:00", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_device_owner": "compute:DC1_KVM", - "NWA_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_network_id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet": "192.168.200.0", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet_id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "physical_network", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD": "connected", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD_VlanID": "4000", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_VlanID": "38", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev_fail.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev_fail.json deleted file mode 100644 index 57f32cb..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_data_two_port_general_dev_fail.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "CreateTenant": 1, - "CreateTenantNW": 1, - "DEV_2180ae23-ad33-4a89-8eef-f2f28e62e789_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "GeneralDev", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f": "device_id", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_TYPE": "GeneralDev", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_ip_address": "192.168.200.132", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_a94fd0fc-2282-4092-9485-b0f438b0f6c4_mac_address": "fa:16:3e:a6:1d:00", - "DEV_36509c40-58e0-4293-8b16-48b409959b8f_device_owner": "compute:DC1_KVM", - "NWA_tenant_id": "DC1_844eb55f21e84a289e9c22098d387e5d", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "pj1-net100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_network_id": "a94fd0fc-2282-4092-9485-b0f438b0f6c4", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_nwa_network_name": "LNW_BusinessVLAN_100", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet": "192.168.200.0", - "NW_a94fd0fc-2282-4092-9485-b0f438b0f6c4_subnet_id": "94fdaea5-33ae-4411-b6e0-71e4b099d470", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP": "physical_network", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_CreateVlan": "", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD": "connected", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_GD_VlanID": "37", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_OpenStack/DC1/APP_VlanID": "38", - "VLAN_a94fd0fc-2282-4092-9485-b0f438b0f6c4_VlanID": "4000" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_ex1.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_ex1.json deleted file mode 100644 index 4cb0b74..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_ex1.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "device": { - "id": "171fff51-ac4c-444e-99a2-8957ca0fad6e", - "owner": "compute:DC1_KVM" - }, - "network": { - "id": "0ed65870-9acb-48ce-8c0b-e803d527a9d2", - "name": "net100", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC02_844eb55f21e84a289e9c22098d387e5d", - "physical_network": "OpenStack/DC1/APP", - "port": { - "id": "81f78799-fd82-48ce-98c3-3df91fb4768c", - "ip": "192.168.100.102", - "mac": "fa:16:3e:1b:27:f9" - }, - "resource_group": "OpenStack/DC1/APP", - "resource_group_name": "OpenStack/DC1/APP", - "resource_group_name_nw": "OpenStack/DC1/APP", - "subnet": { - "id": "df2a7b8a-e027-49ab-bf84-ade82a3c096c", - "mask": "24", - "netaddr": "192.168.100.0" - }, - "tenant_id": "844eb55f21e84a289e9c22098d387e5d" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed1.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed1.json deleted file mode 100644 index e6d938d..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed1.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "owner": "network:dhcp" - }, - "network": { - "id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "name": "net01", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "physical_network": "OpenStack/DC/HA1", - "port": { - "id": "519c51b8-9328-455a-8ae7-b204754eacea", - "ip": "192.168.0.1", - "mac": "fa:16:3e:76:ab:0e" - }, - "resource_group_name": "OpenStack/DC/HA1", - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "mask": "24", - "netaddr": "192.168.0.0" - }, - "tenant_id": "5d9c51b1d6a34133bb735d4988b309c2" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed2.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed2.json deleted file mode 100644 index 4f0234f..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed2.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "18972752-f0f4-4cf7-b185-971ff6539d21", - "owner": "compute:DC01_KVM02_ZONE02" - }, - "network": { - "id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "name": "net01", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "physical_network": "OpenStack/DC/HA1", - "port": { - "id": "faa923cc-3bfc-44d1-a66a-31b75b5aad7a", - "ip": "192.168.0.3", - "mac": "fa:16:3e:5c:3f:c2" - }, - "resource_group_name": "OpenStack/DC/HA1", - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "mask": "24", - "netaddr": "192.168.0.0" - }, - "tenant_id": "5d9c51b1d6a34133bb735d4988b309c2" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed3.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed3.json deleted file mode 100644 index d29b5a0..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_create_general_dev_succeed3.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "18972752-f0f4-4cf7-b185-971ff6539d21", - "owner": "compute:DC01_KVM02_ZONE02" - }, - "network": { - "id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "name": "net01", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "physical_network": "OpenStack/DC/HA2", - "port": { - "id": "faa923cc-3bfc-44d1-a66a-31b75b5aad7a", - "ip": "192.168.0.3", - "mac": "fa:16:3e:5c:3f:c2" - }, - "resource_group_name": "OpenStack/DC/HA2", - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "mask": "24", - "netaddr": "192.168.0.0" - }, - "tenant_id": "5d9c51b1d6a34133bb735d4988b309c2" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed1.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed1.json deleted file mode 100644 index e6d938d..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed1.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "owner": "network:dhcp" - }, - "network": { - "id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "name": "net01", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "physical_network": "OpenStack/DC/HA1", - "port": { - "id": "519c51b8-9328-455a-8ae7-b204754eacea", - "ip": "192.168.0.1", - "mac": "fa:16:3e:76:ab:0e" - }, - "resource_group_name": "OpenStack/DC/HA1", - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "mask": "24", - "netaddr": "192.168.0.0" - }, - "tenant_id": "5d9c51b1d6a34133bb735d4988b309c2" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed2.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed2.json deleted file mode 100644 index e6d938d..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed2.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "owner": "network:dhcp" - }, - "network": { - "id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "name": "net01", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "physical_network": "OpenStack/DC/HA1", - "port": { - "id": "519c51b8-9328-455a-8ae7-b204754eacea", - "ip": "192.168.0.1", - "mac": "fa:16:3e:76:ab:0e" - }, - "resource_group_name": "OpenStack/DC/HA1", - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "mask": "24", - "netaddr": "192.168.0.0" - }, - "tenant_id": "5d9c51b1d6a34133bb735d4988b309c2" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed3.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed3.json deleted file mode 100644 index e6d938d..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_delete_general_dev_succeed3.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "dhcp754b775b-af0d-5760-b6fc-64c290f9fc0b-0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "owner": "network:dhcp" - }, - "network": { - "id": "0f17fa8f-40fe-43bd-8573-1a1e1bfb699d", - "name": "net01", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2", - "physical_network": "OpenStack/DC/HA1", - "port": { - "id": "519c51b8-9328-455a-8ae7-b204754eacea", - "ip": "192.168.0.1", - "mac": "fa:16:3e:76:ab:0e" - }, - "resource_group_name": "OpenStack/DC/HA1", - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "3ba921f6-0788-40c8-b273-286b777d8cfe", - "mask": "24", - "netaddr": "192.168.0.0" - }, - "tenant_id": "5d9c51b1d6a34133bb735d4988b309c2" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_get_resource_group_name.json b/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_get_resource_group_name.json deleted file mode 100644 index 9490ac9..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_data/nwa_info_get_resource_group_name.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "device": { - "id": "dhcpcea0d383-9268-577e-ba23-10e5e2d43886-315414a5-8d06-4d8e-8932-6f73665e5733", - "owner": "compute:DC01_KVM01_ZONE01" - }, - "network": { - "id": "315414a5-8d06-4d8e-8932-6f73665e5733", - "name": "LNetA", - "vlan_id": "123", - "vlan_type": "BusinessVLAN" - }, - "nwa_tenant_id": "T01DC7483b391c2c647c59097240d59e705d4", - "physical_network": "OpenStack/DC/HA1", - "port": { - "id": "4693c521-280c-4052-a95d-f2fd53052824", - "ip": "192.168.1.3", - "mac": "fa:16:3e:71:5c:2c" - }, - "resource_group_name": null, - "resource_group_name_nw": "OpenStack/DC/APP", - "subnet": { - "id": "85fcc2a6-a121-4635-814d-04df134090ab", - "mask": "24", - "netaddr": "192.168.1.0" - }, - "tenant_id": "7483b391c2c647c59097240d59e705d4" -} diff --git a/networking_nec/tests/unit/nwa/agent/test_nwa_agent.py b/networking_nec/tests/unit/nwa/agent/test_nwa_agent.py deleted file mode 100644 index 070706d..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_nwa_agent.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import patch -from oslo_config import cfg - -from networking_nec.nwa.agent import nwa_agent -from networking_nec.tests.unit.nwa.agent import base - - -class TestNECNWANeutronAgentAsNwaClient(base.TestNWAAgentBase): - - @patch('neutron.common.rpc.Connection') - @patch('neutron.agent.rpc.PluginReportStateAPI') - @patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi') - def test__setup_rpc(self, f1, f2, f3): - self.agent.setup_rpc() - self.assertIsNotNone(self.agent.host) - self.assertIsNotNone(self.agent.agent_id) - self.assertIsNotNone(self.agent.context) - self.assertIsNotNone(self.agent.nwa_l2_rpc) - self.assertIsNotNone(self.agent.state_rpc) - self.assertIsNotNone(self.agent.callback_nwa) - self.assertIsNotNone(self.agent.callback_proxy) - - @patch('neutron.common.rpc.Connection') - @patch('neutron.agent.rpc.PluginReportStateAPI') - @patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi') - def test__setup_rpc_no_report_interval(self, f1, f2, f3): - self.agent.conf.NWA.lbaas_driver = True - self.agent.conf.NWA.fwaas_driver = True - cfg.CONF.AGENT.report_interval = 0 - self.agent.setup_rpc() - self.assertIsNotNone(self.agent.host) - self.assertIsNotNone(self.agent.agent_id) - self.assertIsNotNone(self.agent.context) - self.assertIsNotNone(self.agent.nwa_l2_rpc) - self.assertIsNotNone(self.agent.state_rpc) - self.assertIsNotNone(self.agent.callback_nwa) - self.assertIsNotNone(self.agent.callback_proxy) - - def test__report_state(self): - self.assertIsNone(self.agent._report_state()) - - def test_loop_handler(self): - self.assertIsNone(self.agent.loop_handler()) - - @patch('time.sleep') - def test_daemon_loop(self, f1): - f1.side_effect = ValueError('dummy exception') - self.assertRaises( - ValueError, - self.agent.daemon_loop - ) - - -@patch('networking_nec.nwa.agent.nwa_agent.NECNWANeutronAgent') -@patch('neutron.common.config') -@patch('sys.argv') -def test_main(f1, f2, f3): - nwa_agent.main() diff --git a/networking_nec/tests/unit/nwa/agent/test_proxy_l2.py b/networking_nec/tests/unit/nwa/agent/test_proxy_l2.py deleted file mode 100644 index 40b4a6d..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_proxy_l2.py +++ /dev/null @@ -1,532 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import os.path - -import mock -from oslo_serialization import jsonutils -import six -import testscenarios - -from networking_nec.nwa.agent import proxy_l2 -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.tests.unit.nwa.agent import base - - -def load_data_file(name): - base_dir = os.path.dirname(__file__) - fn = os.path.join(base_dir, 'test_data', name) - with open(fn) as f: - return jsonutils.loads(f.read()) - - -class TestAgentProxyL2(base.TestNWAAgentBase): - - def test__create_tenant_nw_fail(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + tenant_id - resource_group_name = 'OpenStack/DC1/APP' - nwa_data1 = {} - nwa_info = { - 'resource_group_name': resource_group_name, - 'resource_group_name_nw': resource_group_name, - } - self.nwacli.l2.create_tenant_nw.return_value = 500, {} - e = self.assertRaises( - nwa_exc.AgentProxyException, - self.agent.proxy_l2._create_tenant_nw, - mock.sentinel.context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - resource_group_name=resource_group_name, - nwa_data=nwa_data1, - nwa_info=nwa_info, - ) - ret_val = e.value - self.assertEqual(ret_val, nwa_data1) - - def test__create_tenant_nw_with_key(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + tenant_id - resource_group_name = 'OpenStack/DC1/APP' - nwa_data1 = {proxy_l2.KEY_CREATE_TENANT_NW: True} - nwa_info = { - 'resource_group_name': resource_group_name, - 'resource_group_name_nw': resource_group_name, - } - result = self.agent.proxy_l2._create_tenant_nw( - mock.sentinel.context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - resource_group_name=resource_group_name, - nwa_data=nwa_data1, - nwa_info=nwa_info, - ) - self.assertIsNone(result) - - def test__create_vlan_succeed1(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + '844eb55f21e84a289e9c22098d387e5d' - # resource_group_name = 'OpenStack/DC1/APP' - nwa_data = {} - nwa_info = load_data_file('add_router_interface_nwa_info.json') - ret_vln = load_data_file('create_vlan_result.json') - ret_vln['resultdata']['VlanID'] = '300' - self.nwacli.l2.create_vlan.return_value = (200, ret_vln) - result = self.agent.proxy_l2._create_vlan( - mock.sentinel.context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info, - nwa_data=nwa_data - ) - exp_data = load_data_file('expected_proxy_create_vlan_succeed1.json') - self.assertDictEqual(exp_data, result) - - def test__create_vlan_succeed2(self): - net_id = '546a8551-5c2b-4050-a769-cc3c962fc5cf' - vlan_id_key = 'VLAN_' + net_id - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + '844eb55f21e84a289e9c22098d387e5d' - # resource_group_name = 'OpenStack/DC1/APP' - nwa_data = {vlan_id_key: 'net-uuid-1'} - nwa_info = load_data_file('add_router_interface_nwa_info.json') - ret_vln = load_data_file('create_vlan_result.json') - ret_vln['resultdata']['VlanID'] = '300' - ret_vln['resultdata'][net_id] = 'net-uuid-1' - self.nwacli.l2.create_vlan.return_value = (200, ret_vln) - result = self.agent.proxy_l2._create_vlan( - mock.sentinel.context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info, - nwa_data=nwa_data - ) - self.assertDictEqual(nwa_data, result) - - def test__create_vlan_fail1(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + '844eb55f21e84a289e9c22098d387e5d' - # resource_group_name = 'OpenStack/DC1/APP' - nwa_data = {'NW_546a8551-5c2b-4050-a769-cc3c962fc5cf': 'net100'} - nwa_info = load_data_file('add_router_interface_nwa_info.json') - self.nwacli.l2.create_vlan.return_value = 500, {} - self.assertRaises( - nwa_exc.AgentProxyException, - self.agent.proxy_l2._create_vlan, - mock.sentinel.context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info, - nwa_data=nwa_data - ) - - def test__delete_vlan_succeed1(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + '844eb55f21e84a289e9c22098d387e5d' - # resource_group_name = 'OpenStack/DC1/APP' - nwa_data = load_data_file('nwa_data_delete_vlan_succeed1.json') - nwa_info = load_data_file('add_router_interface_nwa_info.json') - dvl_result = load_data_file('delete_vlan_result.json') - self.nwacli.l2.create_vlan.return_value = (200, dvl_result) - result = self.agent.proxy_l2._delete_vlan( - mock.sentinel.context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info, - nwa_data=nwa_data - ) - self.assertDictEqual(nwa_data, result) - - def test_check_vlan_for_tenant_fw(self): - network_id = '546a8551-5c2b-4050-a769-cc3c962fc5cf' - segment = 'OpenStack/DC1/APP' - nwa_data = {'VLAN_%s_%s_VlanID' % (network_id, segment): '4000'} - self.assertEqual(1, proxy_l2.check_vlan(network_id, nwa_data)) - - def test_check_vlan_for_tenant_lb(self): - network_id = '546a8551-5c2b-4050-a769-cc3c962fc5cf' - segment = 'OpenStack/DC1/APP' - nwa_data = {'VLAN_LB_%s_%s_VlanID' % (network_id, segment): '4000'} - self.assertEqual(1, proxy_l2.check_vlan(network_id, nwa_data)) - - -class TestAgentProxyL2CreateGeneralDev(testscenarios.WithScenarios, - base.TestNWAAgentBase): - - scenarios = [ - ('succeed1', - {'retval_create_tenant': (200, {}), - 'retval_create_tenant_nw': (200, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (200, 'create_vlan_result.json'), - 'nwa_info': 'create_general_dev_nwa_info.json', - 'gtb_data': {}}, - ), - ('succeed2', - {'retval_create_tenant': (200, {}), - 'retval_create_tenant_nw': (200, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (200, 'create_vlan_result.json'), - 'nwa_info': 'create_general_dev_nwa_info_2.json', - 'gtb_data': 'nwa_data_one_general_dev.json'}, - ), - ('fail1', - {'retval_create_tenant': (200, {}), - 'retval_create_tenant_nw': (200, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (200, 'create_vlan_result.json'), - 'nwa_info': 'create_general_dev_nwa_info.json', - 'gtb_data': {}}, - ), - ('fail2', - {'retval_create_tenant': (200, {}), - 'retval_create_tenant_nw': (200, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (500, 'create_vlan_result.json'), - 'nwa_info': 'create_general_dev_nwa_info.json', - 'gtb_data': {}}, - ), - ('fail3', - {'retval_create_tenant': (200, {}), - 'retval_create_tenant_nw': (500, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (200, 'create_vlan_result.json'), - 'nwa_info': 'create_general_dev_nwa_info.json', - 'gtb_data': {}}, - ), - ('fail4', - {'retval_create_tenant': (501, {}), - 'retval_create_tenant_nw': (200, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (200, 'create_vlan_result.json'), - 'nwa_info': 'create_general_dev_nwa_info.json', - 'gtb_data': {}}, - ), - ('ex1', - {'retval_create_tenant': (200, {}), - 'retval_create_tenant_nw': (200, 'create_tenant_nw_result.json'), - 'retval_create_vlan': (200, 'create_vlan_result.json'), - 'nwa_info': 'nwa_info_create_general_dev_ex1.json', - 'gtb_data': 'nwa_data_create_general_dev_ex1.json'}, - ), - ] - - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi.get_nwa_tenant_binding') - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi.set_nwa_tenant_binding') - @mock.patch('networking_nec.nwa.agent.proxy_tenant.' - 'AgentProxyTenant.update_tenant_binding') - def test_create_general_dev(self, utb, stb, gtb): - context = mock.MagicMock() - tenant_id = "844eb55f21e84a289e9c22098d387e5d" - nwa_tenant_id = 'DC1_' + tenant_id - - nwa_info = load_data_file(self.nwa_info) - - self.nwacli.tenant.create_tenant.return_value = \ - self.retval_create_tenant - self.nwacli.l2.create_tenant_nw.return_value = ( - self.retval_create_tenant_nw[0], - load_data_file(self.retval_create_tenant_nw[1]) - ) - self.nwacli.l2.create_vlan.return_value = ( - self.retval_create_vlan[0], - load_data_file(self.retval_create_vlan[1]) - ) - - self.agent.proxy_l2.multi_dc = False - if isinstance(self.gtb_data, six.string_types): - gtb.return_value = load_data_file(self.gtb_data) - else: - gtb.return_value = self.gtb_data - self.agent.proxy_l2.create_general_dev( - context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - self.agent.proxy_l2.multi_dc = True - if isinstance(self.gtb_data, six.string_types): - gtb.return_value = load_data_file(self.gtb_data) - else: - gtb.return_value = self.gtb_data - self.agent.proxy_l2.create_general_dev( - context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - -class TestAgentProxyL2DeleteGeneralDev(testscenarios.WithScenarios, - base.TestNWAAgentBase): - - scenarios = [ - ('succeed1', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_one_general_dev.json', - }, - ), - ('succeed2', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_two_general_dev.json', - }, - ), - ('succeed3', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_two_port_general_dev.json', - }, - ), - ('fail1', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_one_general_dev.json', - }, - ), - ('fail2', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_one_general_dev.json', - }, - ), - ('fail3', - {'retval_delete_tenant': (500, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_one_general_dev.json', - }, - ), - ('fail4', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (500, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_one_general_dev.json', - }, - ), - ('fail5', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (500, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_one_general_dev.json', - }, - ), - ('fail6', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': 'nwa_data_two_port_general_dev_fail.json', - }, - ), - ('fail7', - {'retval_delete_tenant': (200, {}), - 'retval_delete_tenant_nw': (200, 'delete_tenant_nw_result.json'), - 'retval_delete_vlan': (200, 'delete_vlan_result.json'), - 'nwa_info': 'delete_general_dev_nwa_info.json', - 'gtb_data': {}, - }, - ), - ] - - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi.get_nwa_tenant_binding') - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi.set_nwa_tenant_binding') - @mock.patch('networking_nec.nwa.agent.proxy_tenant.' - 'AgentProxyTenant.update_tenant_binding') - def test_delete_general_dev(self, utb, stb, gtb): - context = mock.MagicMock() - tenant_id = "844eb55f21e84a289e9c22098d387e5d" - nwa_tenant_id = 'DC1_' + tenant_id - - nwa_info = load_data_file(self.nwa_info) - - self.nwacli.tenant.delete_tenant.return_value = \ - self.retval_delete_tenant - self.nwacli.l2.delete_tenant_nw.return_value = ( - self.retval_delete_tenant_nw[0], - load_data_file(self.retval_delete_tenant_nw[1]) - ) - self.nwacli.l2.delete_vlan.return_value = ( - self.retval_delete_vlan[0], - load_data_file(self.retval_delete_vlan[1]) - ) - - self.agent.proxy_l2.multi_dc = False - if isinstance(self.gtb_data, six.string_types): - gtb.return_value = load_data_file(self.gtb_data) - else: - gtb.return_value = self.gtb_data - self.agent.proxy_l2.delete_general_dev( - context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - self.agent.proxy_l2.multi_dc = True - if isinstance(self.gtb_data, six.string_types): - gtb.return_value = load_data_file(self.gtb_data) - else: - gtb.return_value = self.gtb_data - self.agent.proxy_l2.delete_general_dev( - context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info - ) - - -def test_check_segment(): - network_id = 'a94fd0fc-2282-4092-9485-b0f438b0f6c4' - nwa_data = load_data_file('nwa_data_check_segment.json') - proxy_l2.check_segment(network_id, nwa_data) - - -class TestGetResourceGroupName(base.TestNWAAgentBase): - - def setUp(self): - super(TestGetResourceGroupName, self).setUp() - self.nwa_info = load_data_file('nwa_info_get_resource_group_name.json') - self.nwa_data = load_data_file('nwa_data_get_resource_group_name.json') - self.dev_type = 'GeneralDev' - self.resource_group_name = 'OpenStack/DC/HA1' - - def test_resource_group_name_found(self): - self.assertEqual( - proxy_l2.get_resource_group_name(self.nwa_info, self.nwa_data, - self.dev_type), - self.resource_group_name - ) - - def test_mac_not_found(self): - self.nwa_info['port']['mac'] = 'X' - self.assertIsNone( - proxy_l2.get_resource_group_name(self.nwa_info, self.nwa_data, - self.dev_type)) - - def test_network_id_not_found(self): - self.nwa_info['network']['id'] = 'X' - self.assertIsNone( - proxy_l2.get_resource_group_name(self.nwa_info, self.nwa_data, - self.dev_type)) - - def test_device_id_not_found(self): - self.nwa_info['device']['id'] = 'X' - self.assertIsNone( - proxy_l2.get_resource_group_name(self.nwa_info, self.nwa_data, - self.dev_type)) - - def test_dev_type_not_found(self): - dev_type = 'X' - self.assertIsNone( - proxy_l2.get_resource_group_name(self.nwa_info, self.nwa_data, - dev_type)) - - -class TestNECNWANeutronAgentRpc(testscenarios.WithScenarios, - base.TestNWAAgentBase): - - scenarios = [ - # ### GeneralDev: None - # ### add Openstack/DC/HA1 - ('create_general_dev_succeed1', - {'mode': 'create_general_dev', - 'gtb_data': None, - 'nwa_info': 'nwa_info_create_general_dev_succeed1.json'}), - # ### GeneralDev: Openstack/DC/HA1 - # ### add Openstack/DC/HA1 - ('create_general_dev_succeed2', - {'mode': 'create_general_dev', - 'gtb_data': 'nwa_data_create_general_dev_succeed2.json', - 'nwa_info': 'nwa_info_create_general_dev_succeed2.json', - 'mock_wait_agent_notifier': True}), - # ### GeneralDev: Openstack/DC/HA1 - # ### add Openstack/DC/HA2 - ('create_general_dev_succeed3', - {'mode': 'create_general_dev', - 'gtb_data': 'nwa_data_create_general_dev_succeed3.json', - 'nwa_info': 'nwa_info_create_general_dev_succeed3.json'}), - # ### GeneralDev: Openstack/DC/HA1 x1 - # ### del Openstack/DC/HA1 - ('delete_general_dev_succeed1', - {'mode': 'delete_general_dev', - 'gtb_data': 'nwa_data_delete_general_dev_succeed1.json', - 'nwa_info': 'nwa_info_delete_general_dev_succeed1.json'}), - # ### GeneralDev: Openstack/DC/HA1 x2 - # ### del Openstack/DC/HA1 - ('delete_general_dev_succeed2', - {'mode': 'delete_general_dev', - 'gtb_data': 'nwa_data_delete_general_dev_succeed2.json', - 'nwa_info': 'nwa_info_delete_general_dev_succeed2.json'}), - # ### GeneralDev: Openstack/DC/HA1 x1, Openstack/DC/HA2 x1 - # ### del Openstack/DC/HA1 - ('delete_general_dev_succeed3', - {'mode': 'delete_general_dev', - 'gtb_data': 'nwa_data_delete_general_dev_succeed3.json', - 'nwa_info': 'nwa_info_delete_general_dev_succeed3.json'}), - ] - - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi.get_nwa_tenant_binding') - @mock.patch('networking_nec.nwa.agent.proxy_tenant.' - 'AgentProxyTenant.update_tenant_binding') - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi.set_nwa_tenant_binding') - def test_general_dev(self, stb, utb, gtb): - nwa_tenant_id = "DC_KILO3_5d9c51b1d6a34133bb735d4988b309c2" - tenant_id = "5d9c51b1d6a34133bb735d4988b309c2" - - context = mock.MagicMock() - stb.return_value = {} - utb.return_value = {'status': 'SUCCEED'} - if self.gtb_data: - gtb.return_value = load_data_file(self.gtb_data) - else: - gtb.return_value = None - nwa_info = load_data_file(self.nwa_info) - - if getattr(self, 'mock_wait_agent_notifier', False): - mock.patch('networking_nec.nwa.agent.proxy_l2.WAIT_AGENT_NOTIFIER', - new=0).start() - - if self.mode == 'create_general_dev': - rc = self.agent.proxy_l2.create_general_dev( - context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info) - self.assertTrue(rc) - elif self.mode == 'delete_general_dev': - rc = self.agent.proxy_l2.delete_general_dev( - context, - tenant_id=tenant_id, - nwa_tenant_id=nwa_tenant_id, - nwa_info=nwa_info) - self.assertTrue(rc) - else: - self.fail('mode %s is invalide' % self.mode) diff --git a/networking_nec/tests/unit/nwa/agent/test_proxy_tenant.py b/networking_nec/tests/unit/nwa/agent/test_proxy_tenant.py deleted file mode 100644 index 6d31aa9..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_proxy_tenant.py +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.tests.unit.nwa.agent import base - - -class TestAgentProxyTenant(base.TestNWAAgentBase): - - def test__create_tenant_succeed(self): - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d' - - self.nwacli.tenant.create_tenant.return_value = 200, {} - - body = self.agent.proxy_tenant.create_tenant( - mock.sentinel.context, - nwa_tenant_id=nwa_tenant_id - ) - exp_data = { - 'CreateTenant': True, - 'NWA_tenant_id': 'DC1_844eb55f21e84a289e9c22098d387e5d' - } - self.assertEqual(exp_data, body) - - def test__create_tenant_already_exists(self): - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d' - self.nwacli.tenant.create_tenant.return_value = 500, {} - body = self.agent.proxy_tenant.create_tenant( - mock.sentinel.context, - nwa_tenant_id=nwa_tenant_id - ) - exp_data = { - 'CreateTenant': True, - 'NWA_tenant_id': 'DC1_844eb55f21e84a289e9c22098d387e5d' - } - self.assertEqual(exp_data, body) - - def test__create_tenant_failed(self): - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d' - self.nwacli.tenant.create_tenant.return_value = 400, {} - e = self.assertRaises( - nwa_exc.AgentProxyException, - self.agent.proxy_tenant.create_tenant, - mock.sentinel.context, - nwa_tenant_id=nwa_tenant_id - ) - self.assertEqual(400, e.value) - - def test__delete_tenant(self): - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d' - nwa_data = self.agent.proxy_tenant.delete_tenant( - mock.sentinel.context, - nwa_tenant_id=nwa_tenant_id - ) - self.assertIsInstance(nwa_data, dict) - exp_data = { - 'resultdata': {'LogicalNWName': 'LNW_BusinessVLAN_4000', - 'TenantFWName': 'T1', - 'VlanID': '4000'}, - 'status': 'SUCCEED'} - self.assertDictEqual(exp_data, nwa_data) - - def test__delete_tenant_failed(self): - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d' - self.nwacli.tenant.delete_tenant.return_value = 500, {} - nwa_data = self.agent.proxy_tenant.delete_tenant( - mock.sentinel.context, - nwa_tenant_id=nwa_tenant_id - ) - self.assertDictEqual({}, nwa_data) - - def test__update_tenant_binding_true(self): - context = mock.MagicMock() - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d', - nwa_data = {} - self.agent.proxy_tenant.update_tenant_binding( - context, - tenant_id, - nwa_tenant_id, - nwa_data, - True - ) - - def test__update_tenant_binding_false(self): - context = mock.MagicMock() - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_844eb55f21e84a289e9c22098d387e5d', - nwa_data = {} - self.agent.proxy_tenant.update_tenant_binding( - context, - tenant_id, - nwa_tenant_id, - nwa_data, - False - ) diff --git a/networking_nec/tests/unit/nwa/agent/test_server_manager.py b/networking_nec/tests/unit/nwa/agent/test_server_manager.py deleted file mode 100644 index f7114a0..0000000 --- a/networking_nec/tests/unit/nwa/agent/test_server_manager.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import eventlet -import mock - -from networking_nec.nwa.agent import server_manager -from networking_nec.nwa.common import constants as nwa_const -from networking_nec.tests.unit.nwa.agent import base - - -class TestAgentServerManager(base.TestNWAAgentBase): - - @mock.patch('oslo_messaging.server.service.ServiceBase') - def test_create_tenant_rpc_server(self, f1): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - rd = self.agent.server_manager.create_tenant_rpc_server(tenant_id) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['result'], 'SUCCESS') - self.assertEqual(rd['tenant_id'], tenant_id) - - def _wait_greenpool_resized(self, *args, **kwargs): - class Server(object): - def start(self): - eventlet.sleep(5) - return Server() - - @mock.patch('oslo_messaging.server.service.ServiceBase') - def test_create_tenant_rpc_server_greenpool_resize(self, mhs): - poolsize = 3 - manager = server_manager.ServerManager(self.agent.topic, self.agent, - size=poolsize) - mhs.side_effect = self._wait_greenpool_resized - for i in range(poolsize + 1): - tenant_id = 'T-%d' % i - rd = manager.create_tenant_rpc_server(tenant_id) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['result'], 'SUCCESS') - self.assertEqual(rd['tenant_id'], tenant_id) - self.assertEqual(manager.greenpool_size, - poolsize + nwa_const.NWA_GREENPOOL_ADD_SIZE) - - @mock.patch('oslo_messaging.rpc.server.get_rpc_server') - @mock.patch('networking_nec.nwa.agent.nwa_agent') - @mock.patch('neutron.common.rpc.Connection') - @mock.patch('neutron.agent.rpc.PluginReportStateAPI') - @mock.patch('networking_nec.nwa.l2.rpc.tenant_binding_api.' - 'TenantBindingServerRpcApi') - def test_create_tenant_rpc_server_fail(self, f1, f2, f3, f4, f5): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - self.agent.server_manager.rpc_servers[tenant_id] = { - 'server': None, - 'topic': "%s-%s" % (self.agent.topic, tenant_id) - } - rd = self.agent.server_manager.create_tenant_rpc_server(tenant_id) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['result'], 'FAILED') - - @mock.patch('oslo_messaging.rpc.server.get_rpc_server') - def test_delete_tenant_rpc_server(self, f1): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - self.agent.server_manager.rpc_servers = { - tenant_id: { - 'server': f1, - 'topic': "%s-%s" % (self.agent.topic, tenant_id) - } - } - rd = self.agent.server_manager.delete_tenant_rpc_server(tenant_id) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['result'], 'SUCCESS') - self.assertEqual(rd['tenant_id'], tenant_id) - - def test_delete_tenant_rpc_server_fail(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - self.agent.server_manager.rpc_servers = {} - rd = self.agent.server_manager.delete_tenant_rpc_server(tenant_id) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['result'], 'FAILED') diff --git a/networking_nec/tests/unit/nwa/common/__init__.py b/networking_nec/tests/unit/nwa/common/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/common/test_config.py b/networking_nec/tests/unit/nwa/common/test_config.py deleted file mode 100644 index 4bd34a2..0000000 --- a/networking_nec/tests/unit/nwa/common/test_config.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from neutron.tests import base -from oslo_config import cfg - -# It is required to register nwa options -from networking_nec.nwa.common import config # noqa - - -class TestNWAConfig(base.BaseTestCase): - - def test_section_default_NWA_server_url(self): - self.assertIsNone(cfg.CONF.NWA.server_url) - - def test_section_default_NWA_access_key_id(self): - self.assertIsNone(cfg.CONF.NWA.access_key_id) - - def test_section_default_NWA_secret_access_key(self): - self.assertIsNone(cfg.CONF.NWA.secret_access_key) - - def test_section_default_NWA_resource_group_name(self): - self.assertIsNone(cfg.CONF.NWA.resource_group_name) - - def test_section_default_NWA_region_name(self): - self.assertEqual(cfg.CONF.NWA.region_name, 'RegionOne') - - def test_section_default_NWA_scenario_polling_timer(self): - self.assertEqual(cfg.CONF.NWA.scenario_polling_timer, 10) - - def test_section_default_NWA_scenario_polling_count(self): - self.assertEqual(cfg.CONF.NWA.scenario_polling_count, 6) - - def test_section_default_NWA_use_necnwa_router(self): - self.assertIsInstance(cfg.CONF.NWA.use_necnwa_router, bool) - self.assertTrue(cfg.CONF.NWA.use_necnwa_router) - - def test_section_default_NWA_use_neutron_vlan_id(self): - self.assertIsInstance(cfg.CONF.NWA.use_neutron_vlan_id, bool) - self.assertFalse(cfg.CONF.NWA.use_neutron_vlan_id) - - def test_section_default_NWA_ironic_az_prefix(self): - self.assertEqual(cfg.CONF.NWA.ironic_az_prefix, 'BM_') - - def test_section_default_NWA_use_setting_fw_policy(self): - self.assertFalse(cfg.CONF.NWA.use_setting_fw_policy) - - def test_section_default_NWA_resource_group(self): - self.assertIsNone(cfg.CONF.NWA.resource_group) - - def test_section_default_NWA_resource_group_file(self): - self.assertIsNone(cfg.CONF.NWA.resource_group_file) diff --git a/networking_nec/tests/unit/nwa/common/test_utils.py b/networking_nec/tests/unit/nwa/common/test_utils.py deleted file mode 100644 index 000678c..0000000 --- a/networking_nec/tests/unit/nwa/common/test_utils.py +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base -from oslo_config import cfg -from oslo_serialization import jsonutils - -from networking_nec.nwa.common import utils as nwa_com_utils - - -class TestCommonUtils(base.BaseTestCase): - - def test_get_tenant_info(self): - - class network_context(object): - network = mock.MagicMock() - current = mock.MagicMock() - _plugin = mock.MagicMock() - _plugin_context = mock.MagicMock() - - context = network_context() - context.network.current = {} - context.network.current['tenant_id'] = 'T1' - context.network.current['name'] = 'PublicVLAN_100' - context.network.current['id'] = 'Uuid-PublicVLAN_100' - - tid, nid = nwa_com_utils.get_tenant_info(context) - self.assertEqual(tid, 'T1') - self.assertEqual(nid, 'RegionOneT1') - - def _test_load_json_from_file_from_file(self, json_str=None): - json_data = {'foo': 'bar'} - json_file = self.get_temp_file_path('test.json') - with open(json_file, 'w') as f: - f.write(jsonutils.dumps(json_data)) - ret = nwa_com_utils.load_json_from_file('test', json_file, - json_str, []) - self.assertEqual(json_data, ret) - - def test_load_json_from_file_from_file(self): - self._test_load_json_from_file_from_file() - - def test_load_json_from_file_from_str(self): - json_data = {'foo': 'bar'} - json_str = jsonutils.dumps(json_data) - ret = nwa_com_utils.load_json_from_file('test', None, json_str, []) - self.assertEqual(json_data, ret) - - def test_load_json_from_file_both_specified(self): - # json_file has priority. json_str passed here is not evaluated. - self._test_load_json_from_file_from_file(json_str='invalid') - - def test_load_json_from_file_no_json_file_abspath(self): - json_file = 'test.json' - self.assertRaises(cfg.Error, - nwa_com_utils.load_json_from_file, - 'test', json_file, None, []) - - def test_load_json_from_file_with_invalid_json_file(self): - json_file = self.get_temp_file_path('test.json') - with open(json_file, 'w') as f: - f.write('invalid json data') - self.assertRaises(cfg.Error, - nwa_com_utils.load_json_from_file, - 'test', json_file, None, []) - - def test_load_json_from_file_with_invalid_json_str(self): - self.assertRaises(cfg.Error, - nwa_com_utils.load_json_from_file, - 'test', None, 'invalid json str', []) - - def test_load_json_from_file_default_value(self): - self.assertEqual( - 'test_data', - nwa_com_utils.load_json_from_file('test', None, None, 'test_data')) diff --git a/networking_nec/tests/unit/nwa/l2/__init__.py b/networking_nec/tests/unit/nwa/l2/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/l2/drivers/__init__.py b/networking_nec/tests/unit/nwa/l2/drivers/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py b/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py deleted file mode 100644 index 99c378b..0000000 --- a/networking_nec/tests/unit/nwa/l2/drivers/test_mech_necnwa.py +++ /dev/null @@ -1,655 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import MagicMock -from mock import patch - -from neutron.common import constants as neutron_const -from neutron import context -from neutron.extensions import providernet as prov_net -from neutron.tests.unit import testlib_api -from neutron_lib import constants -from oslo_config import cfg -from oslo_serialization import jsonutils - -from networking_nec.nwa.common import constants as nwa_const -from networking_nec.nwa.common import exceptions as nwa_exc -from networking_nec.nwa.l2.drivers import mech_necnwa as mech - - -class TestMechNwa(testlib_api.SqlTestCase): - def setUp(self): - super(TestMechNwa, self).setUp() - - class network_context(object): - network = MagicMock() - current = MagicMock() - _plugin = MagicMock() - _plugin_context = MagicMock() - _binding = MagicMock() - - _plugin_context.session = context.get_admin_context().session - - def set_binding(self, segment_id, vif_type, vif_details, - status=None): - self._binding.segment = segment_id - self._binding.vif_type = vif_type - self._binding.vif_details = vif_details - self._new_port_status = status - - self.context = network_context() - self.context.network.current = { - 'tenant_id': 'tenant201', - 'name': 'tenant 201', - 'id': '61', - 'network_type': 'vlan', - 'physical_network': 'Common/App/Pod3', - 'segments': [] - } - self.context._port = { - 'binding:vif_details': {}, - 'binding:vif_type': 'ovs', - 'binding:vnic_type': 'normal', - 'id': 'uuid-port-100', - 'device_owner': constants.DEVICE_OWNER_ROUTER_INTF, - 'device_id': 'uuid-device_id_100', - 'fixed_ips': [ - {'ip_address': '192.168.120.1', - 'subnet_id': '65e6bc06-09b5-4a16-b093-cbc177818b9e'} - ], - 'mac_address': '12:34:56:78:9a:bc' - } - self.context._binding.segment = '' - self.context._binding.vif_type = '' - - self.host_agents = [ - { - "binary": "neutron-openvswitch-agent", - "description": None, - "admin_state_up": True, - "alive": True, - "topic": "N/A", - "host": "harry", - "agent_type": "Open vSwitch agent", - "id": "a01dc42f-0d15-43ff-8f80-22e15cfe715d", - "configurations": { - "tunnel_types": [], - "tunneling_ip": "", - "bridge_mappings": { - "Common/App/Pod3": "br-eth1", - "Common/KVM/Pod1-1": "br-eth2" - }, - "l2_population": False, - "devices": 0 - }, - "alive": True - }, - { - "binary": "neutron-openvswitch-agent", - "description": None, - "admin_state_up": True, - "alive": True, - "topic": "N/A", - "host": "harry", - "agent_type": "Open vSwitch agent", - "id": "a01dc42f-0d15-43ff-8f80-22e15cfe715d", - "configurations": { - "tunnel_types": [], - "tunneling_ip": "", - "bridge_mappings": { - "Common/App/Pod4": "br-eth1" - }, - "l2_population": False, - "devices": 0 - }, - "alive": False - } - ] - self.context.host_agents = MagicMock(return_value=self.host_agents) - - self.network_segments = [ - { - "provider:network_type": "vlan", - "provider:physical_network": "Common/KVM/Pod1-1", - "id": "uuid-1-1", - "provider:segmentation_id": 100 - }, - { - "network_type": "vlan", - "physical_network": "Common/KVM/Pod1-2", - "id": "uuid-1-2", - "provider:segmentation_id": 101 - }, - { - "provider:network_type": "vlan", - "provider:physical_network": "Common/App/Pod3", - "id": "61", - "provider:segmentation_id": 102 - } - ] - self.context.network.network_segments = self.network_segments - self.context.original = MagicMock() - - resource_group = [ - { - "physical_network": "Common/KVM/Pod1-1", - "device_owner": "compute:AZ1", - "ResourceGroupName": "Common/KVM/Pod1-1" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": "ironic:isolation", - "ResourceGroupName": "Common/App/Pod3" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": "network:dhcp", - "ResourceGroupName": "Common/App/Pod3" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": constants.DEVICE_OWNER_ROUTER_GW, - "ResourceGroupName": "Common/App/Pod3" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": constants.DEVICE_OWNER_ROUTER_INTF, - "ResourceGroupName": "Common/App/Pod3" - } - ] - - fn_resource_group = self.get_temp_file_path('resource_group.json') - with open(fn_resource_group, 'w') as f: - f.write(jsonutils.dumps(resource_group)) - cfg.CONF.set_override('resource_group_file', fn_resource_group, - group='NWA') - - -class TestNECNWAMechanismDriver(TestMechNwa): - def setUp(self): - super(TestNECNWAMechanismDriver, self).setUp() - self.driver = mech.NECNWAMechanismDriver() - self.driver.initialize() - - self.rcode = MagicMock() - self.rcode.value_json = { - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201' - } - - def _get_nwa_tenant_binding(self, value_json): - rcode = MagicMock() - rcode.value_json = value_json - return rcode - - def test_create_port_precommit_compute(self): - self.context._port['device_owner'] = 'compute:DC01_KVM01_ZONE01' - self.driver.create_port_precommit(self.context) - - def test_create_port_precommit_group_not_found(self): - self.driver.resource_groups = [ - { - "physical_network": "Common/App/Pod3", - "device_owner": constants.DEVICE_OWNER_ROUTER_GW, - "ResourceGroupName": "Common/App/Pod3" - } - ] - self.assertRaises(nwa_exc.ResourceGroupNameNotFound, - self.driver.create_port_precommit, self.context) - - @patch('networking_nec.nwa.l2.db_api.add_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_create_port_precommit_owner_router_intf(self, gntb, antb): - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self.rcode - self.driver.create_port_precommit(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_62': constants.DEVICE_OWNER_ROUTER_INTF, - 'DEV_uuid-device_id_100_62_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_62_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.create_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.add_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_create_port_precommit_owner_router_gw(self, gntb, antb): - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_GW - gntb.return_value = self.rcode - self.driver.create_port_precommit(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_GW - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_62': constants.DEVICE_OWNER_ROUTER_GW, - 'DEV_uuid-device_id_100_62_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_62_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.create_port_precommit(self.context) - - def test_update_port_precommit(self): - for device_owner in (constants.DEVICE_OWNER_ROUTER_INTF, - constants.DEVICE_OWNER_ROUTER_GW): - self.context._port['device_owner'] = device_owner - self.driver.update_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.utils.portcontext_to_nwa_info') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_update_port_precommit_current_none(self, gntb, ptni): - self.context.current = self.context._port - self.context.current['device_id'] = None - self.context.current['device_owner'] = None - self.context.original[ - 'device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - self.context.original['device_id'] = 'uuid-device_id_000' - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100_61': constants.DEVICE_OWNER_ROUTER_INTF, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - ptni.return_value = { - 'tenant_id': 'Tenant1', - 'nwa_tenant_id': 'RegionOnetenant201', - 'resource_group_name': 'Common/App/Pod3', - 'physical_network': 'Common/App/Pod3'} - self.driver.update_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.set_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_router_interface(self, gntb, sntb): - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self.rcode - self.driver.delete_port_precommit(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100_61': constants.DEVICE_OWNER_ROUTER_INTF, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100_61': constants.DEVICE_OWNER_ROUTER_INTF, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100_61': constants.DEVICE_OWNER_ROUTER_INTF, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc', - 'DEV_uuid-device_id_100_62_ip_address': '192.168.120.2'} - ) - self.driver.delete_port_precommit(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100_61': 'net001', - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc', - 'DEV_uuid-device_id_100_62_ip_address': '192.168.120.2'} - ) - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.set_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_network_floatingip(self, gntb, sntb): - self.context._port['device_owner'] = 'network:floatingip' - gntb.return_value = self.rcode - router_intf = constants.DEVICE_OWNER_ROUTER_INTF - self.context._port['device_owner'] = router_intf - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': router_intf, - 'DEV_uuid-device_id_100_61': 'net001', - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc', - 'DEV_uuid-device_id_101_61': '12'} - ) - self.driver.delete_port_precommit(self.context) - - self.context._port['device_owner'] = router_intf - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': router_intf, - 'DEV_uuid-device_id_100_61': 'net001', - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - self.context._port['device_owner'] = router_intf - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': router_intf, - 'DEV_uuid-device_id_100_61': 'net001', - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.set_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_router_gateway(self, gntb, sntb): - router_gw = constants.DEVICE_OWNER_ROUTER_GW - self.context._port['device_owner'] = router_gw - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': 1, - 'CreateTenantNW': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': router_gw, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61': 'public001', - 'DEV_uuid-device_id_100_61_ip_address': '172.16.1.23', - 'DEV_uuid-device_id_100_63_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.set_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_floatingip(self, gntb, sntb): - floatingip = constants.DEVICE_OWNER_FLOATINGIP - self.context._port['device_owner'] = floatingip - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': 1, - 'CreateTenantNW': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': floatingip, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61': 'public001', - 'DEV_uuid-device_id_100_61_ip_address': '172.16.1.23', - 'DEV_uuid-device_id_100_63_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.set_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_none(self, gntb, sntb): - self.context._port['device_owner'] = '' - self.context._port['device_id'] = '' - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': 1, - 'CreateTenantNW': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': '', - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61': 'public001', - 'DEV_uuid-device_id_100_61_ip_address': '172.16.1.23', - 'DEV_uuid-device_id_100_63_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.utils.portcontext_to_nwa_info') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_dhcp(self, gntb, ptni): - self.context._port['device_owner'] = constants.DEVICE_OWNER_DHCP - self.context._port[ - 'device_id'] = neutron_const.DEVICE_ID_RESERVED_DHCP_PORT - self.context._port['binding:host_id'] = 'myhost' - - # _revert_dhcp_agent_device - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': 1, - 'CreateTenantNW': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': constants.DEVICE_OWNER_DHCP, - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_TFW, - 'DEV_uuid-device_id_100_61': 'public001', - 'DEV_uuid-device_id_100_61_ip_address': '172.16.1.23', - 'DEV_uuid-device_id_100_63_mac_address': '12:34:56:78:9a:bc'} - ) - ptni.return_value = { - 'tenant_id': 'Tenant1', - 'nwa_tenant_id': 'RegionOnetenant201', - 'device': { - 'owner': constants.DEVICE_OWNER_DHCP, - 'id': 'device_id'}, - 'resource_group_name': 'Common/App/Pod3', - 'physical_network': 'Common/App/Pod3'} - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.set_nwa_tenant_binding') - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_delete_port_precommit_owner_compute_az(self, gntb, sntb): - # 1 net 1 port(compute:AZ1) - self.context.current = self.context._port - self.context.current['device_owner'] = 'compute:AZ1' - self.context._port['device_owner'] = 'compute:AZ1' - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': 'compute:AZ1', - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_GDV, - 'DEV_uuid-device_id_100_61': 'net001', - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - # 1 net 2 port(compute:AZ1) - self.context._port['device_owner'] = 'compute:AZ1' - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_device_owner': 'compute:AZ1', - 'DEV_uuid-device_id_100_61_TYPE': nwa_const.NWA_DEVICE_GDV, - 'DEV_uuid-device_id_100_61': 'net001', - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc', - 'DEV_uuid-device_id_200': 'device_id', - 'DEV_uuid-device_id_200_device_owner': 'compute:AZ1', - 'DEV_uuid-device_id_200_61_TYPE': nwa_const.NWA_DEVICE_GDV, - 'DEV_uuid-device_id_200_61': 'net001', - 'DEV_uuid-device_id_200_61_ip_address': '192.168.120.2', - 'DEV_uuid-device_id_200_61_mac_address': 'fe:34:56:78:9a:bc'} - ) - self.driver.delete_port_precommit(self.context) - - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_try_to_bind_segment_for_agent(self, gntb): - # in segment - self.context._port['device_owner'] = 'network:dhcp' - self.context._port['fixed_ips'] = [] - self.context.current = self.context._port - rb = self.driver.try_to_bind_segment_for_agent( - self.context, self.network_segments[1], self.host_agents[0]) - self.assertEqual(rb, True) - - # in physical_network - self.context.network.current[ - 'provider:physical_network'] = 'Common/App/Pod3' - self.context.network.current['provider:segmentation_id'] = 199 - self.context.current = self.context._port - rb = self.driver.try_to_bind_segment_for_agent( - self.context, self.network_segments[1], self.host_agents[0]) - self.assertEqual(rb, True) - - # not in segment - rb = self.driver.try_to_bind_segment_for_agent( - self.context, self.network_segments[1], self.host_agents[1]) - self.assertEqual(rb, False) - - # device_owner is router_gw - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_GW - rb = self.driver.try_to_bind_segment_for_agent( - self.context, self.network_segments[1], self.host_agents[0]) - self.assertEqual(rb, False) - - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_try_to_bind_segment_for_agent_in_segments(self, gntb): - # in segment - self.context._port['device_owner'] = 'network:dhcp' - self.context.network.current['segments'] = self.network_segments - self.context.current = self.context._port - rb = self.driver.try_to_bind_segment_for_agent( - self.context, self.network_segments[2], self.host_agents[0]) - self.assertEqual(rb, True) - - def test__find_nwa_physical_network(self): - pod3_eth1 = self.host_agents[0] - physnet = self.driver._find_nwa_physical_network(self.context, - pod3_eth1) - self.assertEqual(physnet, 'Common/App/Pod3') - - def test__find_nwa_physical_network_no_match(self): - physnet = self.driver._find_nwa_physical_network(self.context, - self.host_agents[1]) - self.assertIsNone(physnet) - - def test__find_nwa_physical_network_agent_none(self): - physnet = self.driver._find_nwa_physical_network(self.context) - self.assertEqual(physnet, 'Common/App/Pod3') - - @patch('neutron.db.segments_db.get_dynamic_segment') - def test__bind_segment_to_vif_type_dummy_segment_none(self, gds): - gds.return_value = None - physnet = 'Common/App/Pod3' - rd = self.driver._bind_segment_to_vif_type(self.context, physnet) - self.assertIsNone(rd) - - @patch('neutron.db.segments_db.get_dynamic_segment') - @patch('neutron.db.segments_db.add_network_segment') - def test__bind_segment_to_vif_type_dummy_segment_exists(self, ans, gds): - gds.return_value = self.network_segments[1] - physnet = 'Common/KVM/Pod1-2' - self.driver._bind_segment_to_vif_type(self.context, physnet) - self.assertEqual(0, ans.call_count) - - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def _test__bind_port_nwa(self, gntb): - # if prov_net.PHYSICAL_NETWORK in self.context.network.current: - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - self.context.network.current[ - 'provider:physical_network'] = 'Common/App/Pod3' - self.context.network.current['provider:segmentation_id'] = 199 - gntb.return_value = None - self.driver._bind_port_nwa(self.context) - - # else: - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - self.context.network.current['segments'] = self.network_segments - gntb.return_value = None - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = None - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_GW - gntb.return_value = None - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self._get_nwa_tenant_binding({ - 'CreateTenant': True, - 'NWA_tenant_id': 'RegionOnetenant201', - 'DEV_uuid-device_id_100': 'device_id', - 'DEV_uuid-device_id_100_61': constants.DEVICE_OWNER_ROUTER_INTF, - 'DEV_uuid-device_id_100_61_ip_address': '192.168.120.1', - 'DEV_uuid-device_id_100_61_mac_address': '12:34:56:78:9a:bc'} - ) - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'network:floatingip' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'ironic:isolation' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'ironic:isolation' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'compute:BM_001' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'compute:BM_001' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'compute:az_001' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'compute:az_001' - gntb.return_value = self.rcode - self.driver._bind_port_nwa(self.context) - - self.context._port['device_owner'] = 'compute:AZ1' - gntb.return_value = self.rcode - self.context.network.current.pop(prov_net.PHYSICAL_NETWORK) - self.driver._bind_port_nwa(self.context) - - # Exception - self.context._port['device_owner'] = constants.DEVICE_OWNER_ROUTER_INTF - gntb.side_effect = Exception - self.driver._bind_port_nwa(self.context) - - @patch('neutron.db.segments_db.get_dynamic_segment') - @patch('neutron.db.segments_db.delete_network_segment') - def test__l2_delete_segment(self, dns, gds): - gds.return_value = None - self.driver._l2_delete_segment(self.context, MagicMock()) - self.assertEqual(0, dns.call_count) - - dns.mock_reset() - gds.return_value = {'id': 'ID-100'} - self.driver._l2_delete_segment(self.context, MagicMock()) - self.assertEqual(1, dns.call_count) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/__init__.py b/networking_nec/tests/unit/nwa/l2/rpc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py deleted file mode 100644 index b14bd0f..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_ml2_server_callback.py +++ /dev/null @@ -1,244 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.extensions import portbindings -from neutron.tests import base -from neutron_lib import constants - -from networking_nec.nwa.l2 import plugin -from networking_nec.nwa.l2.rpc import ml2_server_callback - - -class TestNECNWAServerRpcCallbacks(base.BaseTestCase): - - @mock.patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin._setup_rpc') - @mock.patch('neutron.plugins.ml2.managers.TypeManager.initialize') - def setUp(self, f1, f2): - super(TestNECNWAServerRpcCallbacks, self).setUp() - notifier = mock.MagicMock() - type_manager = mock.MagicMock() - - self.rpc = ml2_server_callback.NwaML2ServerRpcCallbacks( - notifier, type_manager) - - f1.return_value = None - f2.return_value = None - self.l2_plugin = plugin.NECNWAL2Plugin() - - class PortBinding(object): - segment = {'segmentation_id': 1000, - portbindings.VIF_TYPE: 'vlan'} - vif_type = None - segment_id = 'seg-id-1000' - - class PortContext(object): - bound_segment = None - current = {'network_id': 'a70fed9f-52b8-4290-a3ed-cdcc837b78d8', - portbindings.VIF_TYPE: 'vlan', - 'admin_state_up': True, - 'status': constants.PORT_STATUS_DOWN, - 'mac_address': '00:0c:29:1f:f5:1c', - 'fixed_ips': '192.168.1.1', - 'device_owner': 'compute:DC01_KVM01_ZONE01', - portbindings.PROFILE: 'dummy'} - - self.port_binding = PortBinding - self.port_context = PortContext - self.port_context.bottom_bound_segment = mock.MagicMock() - self.port_context.current = mock.MagicMock() - self.port_context.network = mock.MagicMock() - - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details(self, f1, f2, f3): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.return_value = None - - device = self.rpc.get_device_details(rpc_context, kwargs={'test': - "sample"}) - self.assertTrue(device) - - @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_no_segment(self, f1, f2, f3, f4, f5, f6): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.current = True - f4.begin.return_value = None - f5.return_value = None - - device = self.rpc.get_device_details(rpc_context, kwargs={'test': - "sample"}) - self.assertTrue(device) - - @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_multi_segment(self, f1, f2, f3, f4, f5, f6): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.current = True - f4.begin.return_value = None - f5.return_value = [{}, {}] - - device = self.rpc.get_device_details(rpc_context, kwargs={'test': - "sample"}) - self.assertTrue(device) - - @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_segment_size_miss_match(self, f1, f2, f3, f4, - f5, f6): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.current = True - f4.begin.return_value = None - f5.return_value = [{}, {}] - - self.rpc.get_device_details(rpc_context, kwargs={'test': "sample"}) - - @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_segment_zero(self, f1, f2, f3, f4, f5, f6): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.current = True - f3.bottom_bound_segment = mock.MagicMock() - f4.begin.return_value = None - f5.return_value = [{'segmentation_id': 0}] - device = self.rpc.get_device_details(rpc_context, kwargs={'test': - "sample"}) - self.assertIsInstance(device, dict) - - @mock.patch('neutron.plugins.ml2.plugin.Ml2Plugin.update_port_status') - @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_segment_not_binding(self, f1, f2, f3, f4, f5, - f6, f7): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.current = True - f4.begin.return_value = None - f5.return_value = [{'segmentation_id': 1000}] - - class PortBinding(object): - segment = None - vif_type = None - segment_id = None - - f6.return_value = PortBinding() - - device = self.rpc.get_device_details(rpc_context, kwargs={'test': - "sample"}) - self.assertTrue(device) - - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.update_port_status') - @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_bound_segment(self, f1, f2, f3, f4, f5, - f6, f7): - - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - f3.return_value = self.port_context - f4.begin.return_value = None - f5.return_value = [{'segmentation_id': 1000, - 'network_type': 'vlan', - 'physical_network': 'OpenStack/DC1/APP'}] - f6.return_value = self.port_binding - device = self.rpc.get_device_details(rpc_context, - kwargs={'test': "sample"}) - self.assertTrue(device) - - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.update_port_status') - @mock.patch('networking_nec.nwa.l2.db_api.ensure_port_binding') - @mock.patch('neutron.db.segments_db.get_network_segments') - @mock.patch('neutron.db.api.get_session') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin.get_bound_port_context') - @mock.patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._device_to_port_id') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_get_device_details_port_state_change(self, f1, f2, f3, f4, f5, - f6, f7): - rpc_context = mock.MagicMock() - f1.return_value = self.l2_plugin - f2.return_value = None - - self.port_context.bound_segment = 'dummy segment' - f3.return_value = self.port_context - f4.begin.return_value = None - f5.return_value = [{'segmentation_id': 1000, - 'network_type': 'vlan', - 'physical_network': 'OpenStack/DC1/APP'}] - f6.return_value = self.port_binding - - device = self.rpc.get_device_details(rpc_context, - kwargs={'test': "sample"}) - self.assertTrue(device) - - @mock.patch('neutron_lib.plugins.directory.get_plugin') - def test_update_device_up(self, dummy1): - rpc_context = mock.MagicMock() - dummy1.return_value = None - self.rpc.update_device_up(rpc_context) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_api.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_api.py deleted file mode 100644 index 3bfb9ab..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_api.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import nwa_agent_api - - -class TestNECNWAAgentApi(base.BaseTestCase): - - @mock.patch('neutron.common.rpc.get_client') - def setUp(self, f1): - super(TestNECNWAAgentApi, self).setUp() - self.proxy = nwa_agent_api.NECNWAAgentApi("dummy-topic") - self.context = mock.MagicMock() - - def test_create_server(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - self.proxy.create_server(self.context, tenant_id) - - def test_delete_server(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - self.proxy.delete_server(self.context, tenant_id) - - def test_get_nwa_rpc_servers(self): - self.proxy.get_nwa_rpc_servers(self.context) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_callback.py deleted file mode 100644 index 7c89a52..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_agent_callback.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import nwa_agent_callback - - -class TestNECNWAAgentRpcCallback(base.BaseTestCase): - - def setUp(self): - super(TestNECNWAAgentRpcCallback, self).setUp() - self.context = mock.MagicMock() - self.agent = mock.MagicMock() - self.callback = nwa_agent_callback.NwaAgentRpcCallback( - self.context, self.agent - ) - - def test_get_nwa_rpc_server(self): - rd = self.callback.get_nwa_rpc_servers(self.context, kwargs={}) - self.assertIsInstance(rd, dict) - - def test_create_server(self): - params = {'tenant_id': 'T1'} - rd = self.callback.create_server(self.context, kwargs=params) - self.assertIsNotNone(rd) - - def test_delete_server(self): - params = {'tenant_id': 'T1'} - rd = self.callback.delete_server(self.context, kwargs=params) - self.assertIsNotNone(rd) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_api.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_api.py deleted file mode 100644 index 2a50887..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_api.py +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import nwa_l2_server_api - - -class TestNwaL2ServerApi(base.BaseTestCase): - - @mock.patch('neutron.common.rpc.get_client') - def setUp(self, f1): - super(TestNwaL2ServerApi, self).setUp() - self.proxy = nwa_l2_server_api.NwaL2ServerRpcApi("dummy-topic") - self.context = mock.MagicMock() - - def test_release_dynamic_segment_from_agent(self): - cctxt = mock.MagicMock() - self.proxy.client.prepare.return_value = cctxt - self.proxy.release_dynamic_segment_from_agent( - self.context, 'physical_network', 'network_id') - self.assertEqual(1, cctxt.call.call_count) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py deleted file mode 100644 index 09fa806..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_l2_server_callback.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import nwa_l2_server_callback - - -class TestNwaL2ServerRpcCallback(base.BaseTestCase): - - def setUp(self): - super(TestNwaL2ServerRpcCallback, self).setUp() - self.callback = nwa_l2_server_callback.NwaL2ServerRpcCallback() - self.context = mock.MagicMock() - - @mock.patch('neutron.db.api.get_session') - @mock.patch('neutron.db.segments_db.get_dynamic_segment') - @mock.patch('neutron.db.segments_db.delete_network_segment') - def test_release_dynamic_segment_from_agent(self, dns, gds, gs): - del_segment = {'segmentation_id': 0, 'id': 'ID-0'} - gds.return_value = del_segment - self.callback.release_dynamic_segment_from_agent( - self.context, - network_id='network-id', - physical_network='physical-network') - self.assertEqual(0, dns.call_count) - - dns.reset_mock() - del_segment = {'segmentation_id': 4000, 'id': 'ID-4000'} - gds.return_value = del_segment - self.callback.release_dynamic_segment_from_agent( - self.context, - network_id='network-id', - physical_network='physical-network') - self.assertEqual(1, dns.call_count) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_api.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_api.py deleted file mode 100644 index c56a015..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_api.py +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import nwa_proxy_api - - -class TestNECNWAProxyApi(base.BaseTestCase): - - @mock.patch('neutron.common.rpc.get_client') - def setUp(self, f1): - super(TestNECNWAProxyApi, self).setUp() - self.proxy = nwa_proxy_api.NECNWAProxyApi("dummy-topic", - "dummy-tenant-id") - self.context = mock.MagicMock() - - def test__send_msg_true(self): - msg = mock.MagicMock() - self.assertTrue( - self.proxy._send_msg(self.context, msg, blocking=True) - ) - - def test__send_msg_false(self): - msg = mock.MagicMock() - self.assertTrue( - self.proxy._send_msg(self.context, msg, blocking=False) - ) - - def test_create_general_dev(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + tenant_id - nwa_info = {} - self.proxy.create_general_dev(self.context, tenant_id, nwa_tenant_id, - nwa_info) - - def test_delete_general_dev(self): - tenant_id = '844eb55f21e84a289e9c22098d387e5d' - nwa_tenant_id = 'DC1_' + tenant_id - nwa_info = {} - self.proxy.delete_general_dev(self.context, tenant_id, nwa_tenant_id, - nwa_info) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_callback.py deleted file mode 100644 index b3f3b23..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_nwa_proxy_callback.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import nwa_proxy_callback - - -class TestNECNWAProxyCallback(base.BaseTestCase): - - def setUp(self): - super(TestNECNWAProxyCallback, self).setUp() - self.context = mock.MagicMock() - self.agent = mock.MagicMock() - self.callback = nwa_proxy_callback.NwaProxyCallback(self.context, - self.agent) - - def test_create_general_dev(self): - params = {} - self.callback.create_general_dev(self.context, kwargs=params) - - def test_delete_general_dev(self): - params = {} - self.callback.delete_general_dev(self.context, kwargs=params) diff --git a/networking_nec/tests/unit/nwa/l2/rpc/test_tenant_binding_callback.py b/networking_nec/tests/unit/nwa/l2/rpc/test_tenant_binding_callback.py deleted file mode 100644 index d5820d7..0000000 --- a/networking_nec/tests/unit/nwa/l2/rpc/test_tenant_binding_callback.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.l2.rpc import tenant_binding_callback as tenant_cb - - -class TestTenantBindingServerRpcCallback(base.BaseTestCase): - - def setUp(self): - super(TestTenantBindingServerRpcCallback, self).setUp() - self.rpc_context = mock.MagicMock() - self.callback = tenant_cb.TenantBindingServerRpcCallback() - - @mock.patch('neutron.db.api.get_session') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - @mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues') - def test_update_tenant_rpc_servers_both_empty(self, gntq, gs, gp): - gntq.return_value = [] - kwargs = {'servers': []} - rd = self.callback.update_tenant_rpc_servers(self.rpc_context, - **kwargs) - self.assertEqual(rd, {'servers': []}) - - @mock.patch('neutron.db.api.get_session') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - @mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues') - def test_update_tenant_rpc_servers_both_equal(self, gntq, plugin, gs): - q1 = mock.MagicMock() - q1.tenant_id = 'T-1' - gntq.return_value = [q1] - kwargs = {'servers': [{'tenant_id': 'T-1'}]} - rd = self.callback.update_tenant_rpc_servers(self.rpc_context, - **kwargs) - self.assertEqual(rd, {'servers': []}) - self.assertEqual(plugin.nwa_rpc.create_server.call_count, 0) - self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 0) - - @mock.patch('neutron.db.api.get_session') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - @mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues') - def test_update_tenant_rpc_servers_create(self, gntq, gp, gs): - q1 = mock.MagicMock() - q1.tenant_id = 'T-2' - gntq.return_value = [q1] - plugin = mock.MagicMock() - gp.return_value = plugin - plugin.nwa_rpc.create_server = mock.MagicMock() - kwargs = {'servers': []} - rd = self.callback.update_tenant_rpc_servers(self.rpc_context, - **kwargs) - self.assertEqual(rd, {'servers': [{'tenant_id': 'T-2'}]}) - self.assertEqual(plugin.nwa_rpc.create_server.call_count, 1) - self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 0) - - @mock.patch('neutron.db.api.get_session') - @mock.patch('neutron_lib.plugins.directory.get_plugin') - @mock.patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queues') - def test_update_tenant_rpc_servers_delete(self, gntq, gp, gs): - gntq.return_value = [] - plugin = mock.MagicMock() - gp.return_value = plugin - plugin.nwa_rpc.create_server = mock.MagicMock() - kwargs = {'servers': [{'tenant_id': 'T-1'}]} - rd = self.callback.update_tenant_rpc_servers(self.rpc_context, - **kwargs) - self.assertEqual(rd, {'servers': []}) - self.assertEqual(plugin.nwa_rpc.create_server.call_count, 0) - self.assertEqual(plugin.nwa_rpc.delete_server.call_count, 1) diff --git a/networking_nec/tests/unit/nwa/l2/test_db_api.py b/networking_nec/tests/unit/nwa/l2/test_db_api.py deleted file mode 100644 index f669e37..0000000 --- a/networking_nec/tests/unit/nwa/l2/test_db_api.py +++ /dev/null @@ -1,450 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import MagicMock -from mock import patch -from sqlalchemy.orm.exc import NoResultFound -import testscenarios - -from neutron import context -from neutron.tests import base -from neutron.tests.unit import testlib_api - -from networking_nec.nwa.l2 import db_api - -TENANT_ID = 'T1' -NWA_TENANT_ID = 'NWA-T1' -JSON_VALUE = {'a': 1} -VALUE_JSON = {'a': 1} -NETWORK_ID = 'uuid-network_id-1' -DEVICE_ID = 'uuid-device_id-1' -PHYSICAL_NETWORK = 'DC1/Pod1-1' -NETWORK_NAME = 'PublicVLAN_1001' -DEVICE_OWNER = 'network:router_interface' -IP_ADDRESS = '10.0.0.1' -MAC_ADDRESS = '12:34:56:78:9a' -CIDR = 24 - - -class itemval(base.BaseTestCase): - value_json = None - - def __init__(self, v): - self.value_json = v - - def __repr__(self): - return str(self.value_json) - - -class TestNWATenantBinding(base.BaseTestCase): - def test_nwa_tenant_binding(self): - ntb = db_api.NWATenantBinding('T1', 'NWA-T1', {'key': 'value'}) - self.assertIsNotNone(ntb) - self.assertEqual(str(ntb), - "") - - -class TestAddNwaTenantBinding(testlib_api.SqlTestCaseLight): - nwa_tenant1 = 'NWA01' - nwa_tenant2 = 'NWA02' - tenant1 = 'ffffffffff0000000000000000000001' - tenant2 = 'ffffffffff0000000000000000000002' - key1 = 'Key-1' - key2 = 'Key-2' - value1 = 'Value-1' - value2 = 'Value-2' - value_json1 = {key1: value1} - value_json2 = {key2: value2} - - def setUp(self): - super(TestAddNwaTenantBinding, self).setUp() - self.ssn = context.get_admin_context().session - - def get_t1(self): - return db_api.get_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1) - - def add_t1(self, value_json): - return db_api.add_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1, value_json) - - def del_t1(self): - return db_api.del_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1) - - def test_add_del(self): - self.assertIsNone(self.get_t1()) # not found - self.assertTrue(self.add_t1(self.value_json1)) - - # already added - self.assertFalse(self.add_t1(self.value_json2)) - self.assertEqual(self.get_t1().value_json, self.value_json1) - - self.assertTrue(self.del_t1()) - # already deleted - self.assertFalse(self.del_t1()) - self.assertIsNone(self.get_t1()) - - def test_add_del_tenant_id_difference(self): - self.assertIsNone(self.get_t1()) # not found - self.assertTrue(self.add_t1(self.value_json1)) - - self.assertFalse( # already exits - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant2, - self.value_json2)) - self.assertTrue( # diffrent tenant id - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1, - self.value_json2)) - - self.assertEqual(self.get_t1().value_json, self.value_json1) - self.assertEqual( - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1).value_json, - self.value_json2) - - self.assertTrue(self.del_t1()) - self.assertEqual( # no effect - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1).value_json, - self.value_json2) - - def test_tenant_id_no_match(self): - self.assertIsNone(self.get_t1()) # not found - self.assertTrue( # succeed - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1, - {self.key1: self.value1})) - self.assertFalse( # not found - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1)) - self.assertEqual( # get same value - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1).value_json, - {self.key1: self.value1}) - - def test_nwa_tenant_id_no_match(self): - self.assertIsNone(self.get_t1()) # not found - self.assertTrue( # succeed - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant2, - {self.key2: self.value2})) - self.assertFalse( # not found - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1)) - self.assertEqual( # get same value - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant2).value_json, - {self.key2: self.value2}) - - def test_value_is_empty_string(self): - self.assertTrue( - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1, {self.key1: ''})) - self.assertEqual( - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1).value_json, - {self.key1: ''}) - - def test_value_is_none(self): - self.assertTrue( - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1, {self.key1: None})) - self.assertEqual( - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1).value_json, - {self.key1: u''}) - - def test_value_is_true(self): - self.assertTrue( - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1, {self.key1: True})) - self.assertEqual( - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant1).value_json, - {self.key1: True}) - - def test_value_is_false(self): - self.assertTrue( - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant2, {self.key1: False})) - self.assertEqual( - db_api.get_nwa_tenant_binding( - self.ssn, self.tenant2, self.nwa_tenant2).value_json, - {self.key1: False}) - - def test_json_value_not_dict(self): - self.assertFalse( - db_api.add_nwa_tenant_binding( - self.ssn, self.tenant1, self.nwa_tenant1, - [self.value1, self.value2])) # list - - -class TestGetNwaTenantBinding(base.BaseTestCase): - def setUp(self): - super(TestGetNwaTenantBinding, self).setUp() - self.session = MagicMock() - - def test_get_nwa_tenant_binding(self): - self.session.query().filter().filter().all.return_value = [] - rc = db_api.get_nwa_tenant_binding(self.session, - TENANT_ID, NWA_TENANT_ID) - self.assertIsNone(rc) - - def test_get_nwa_tenant_binding_1(self): - nwa = MagicMock() - nwa.json_key, nwa.json_value = 'a', 1 - self.session.query().filter().filter().all.return_value = [nwa] - rc = db_api.get_nwa_tenant_binding(self.session, - TENANT_ID, NWA_TENANT_ID) - self.assertEqual(rc.value_json, {'a': 1}) - - def test_get_nwa_tenant_binding_no_result_found(self): - self.session.query().filter().filter().all.side_effect = NoResultFound - rc = db_api.get_nwa_tenant_binding(self.session, - TENANT_ID, NWA_TENANT_ID) - self.assertIsNone(rc) - - -class TestSetNwaTenantBinding(testscenarios.WithScenarios, base.BaseTestCase): - - scenarios = [ - ('old new json None', - { - 'expected_return_value': False, - 'old_value_json': None, - 'new_value_json': None - }), - ('old json is 1 and new json is None', - { - 'expected_return_value': False, - 'old_value_json': itemval(1), - 'new_value_json': None - }), - ('old json is dict and new json is None', - { - 'expected_return_value': False, - 'old_value_json': itemval({'a': 1}), - 'new_value_json': None - }), - ('old and new json have same key and value', - { - # same key, same value - 'expected_return_value': True, - 'old_value_json': itemval({'a': 1}), - 'new_value_json': {'a': 1}, - 'call_count_update': 0, - 'call_count_insert': 0, - 'call_count_delete': 0 - }), - ('old and new json have same key and same value (True, "True")', - { - # same key, same value (True, "True") XXX - 'expected_return_value': True, - 'old_value_json': itemval({'a': "True"}), - 'new_value_json': {'a': True}, - 'call_count_update': 1, - 'call_count_insert': 0, - 'call_count_delete': 0 - }), - ('old and new json have same key (ignore case)', - { - # same key, same value (ignore case) - 'expected_return_value': True, - 'old_value_json': itemval({'A': 1}), - 'new_value_json': {'a': 1}, - 'call_count_update': 1, - 'call_count_insert': 1, - 'call_count_delete': 1 - }), - ('old and new json has same key and different value', - { - # same key, different value - 'expected_return_value': True, - 'old_value_json': itemval({'a': 1}), - 'new_value_json': {'a': 2}, - 'call_count_update': 1, - 'call_count_insert': 0, - 'call_count_delete': 0 - }), - ('old and new json has different keys', - { - # different key - 'expected_return_value': True, - 'old_value_json': itemval({'a': 1}), - 'new_value_json': {'b': 2}, - 'call_count_update': 1, - 'call_count_insert': 1, - 'call_count_delete': 1 - }), - ('old and new json has multiple different keys', - { - # different key, multiple - 'expected_return_value': True, - 'old_value_json': itemval({ - 'a': 0, - 'b': 1 - }), - 'new_value_json': { - 'b': 1, - 'c': 2 - }, - 'call_count_update': 1, - 'call_count_insert': 1, - 'call_count_delete': 1 - }), - ] - - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_set_nwa_tenant_binding(self, gntb): - - self.session = MagicMock() - gntb.return_value = self.old_value_json - rc = db_api.set_nwa_tenant_binding( - self.session, TENANT_ID, NWA_TENANT_ID, self.new_value_json - ) - self.assertEqual(rc, self.expected_return_value) - if self.expected_return_value: - self.assertEqual(self.session.query().filter().one.call_count, - self.call_count_update) - self.assertEqual(self.session.execute.call_count, - self.call_count_insert) - self.assertEqual(self.session.delete.call_count, - self.call_count_delete) - - -class TestDelNwaTenantBinding(testscenarios.WithScenarios, base.BaseTestCase): - - scenarios = [ - ('old value json is None', - { - 'expected_return_value': False, - 'old_value_json': None - }), - ('old value json is 1', - { - 'expected_return_value': True, - 'old_value_json': 1 - }), - ('no result found', - { - 'expected_return_value': False, - 'old_value_json': 1, - 'delete_not_found': True, - }), - ] - - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_binding') - def test_del_nwa_tenant_binding(self, gntb): - gntb.return_value = self.old_value_json - self.session = MagicMock() - if getattr(self, 'delete_not_found', False): - self.session.query().filter().delete.side_effect = NoResultFound - rc = db_api.del_nwa_tenant_binding(self.session, TENANT_ID, - NWA_TENANT_ID) - self.assertEqual(rc, self.expected_return_value) - - -class TestEnsurePortBinding(base.BaseTestCase): - def setUp(self): - super(TestEnsurePortBinding, self).setUp() - self.session = MagicMock() - - def test_ensure_port_binding(self): - port_id = 'uuid-port_id-1' - self.session.query().filter_by().one.return_value = port_id - rc = db_api.ensure_port_binding(self.session, port_id) - self.assertEqual(rc, port_id) - - @patch('neutron.plugins.ml2.models.PortBinding') - def test_ensure_port_binding_no_result_found(self, mpb): - port_id = 'uuid-port_id-1' - self.session.query().filter_by().one.side_effect = NoResultFound - mpb.return_value = 'uuid-port_id-2' - self.assertRaises( - NoResultFound, - db_api.ensure_port_binding, self.session, port_id - ) - - -class TestTenantQueue(testlib_api.SqlTestCase): - - tenant1 = 'ffffffffff0000000000000000000001' - tenant2 = 'ffffffffff0000000000000000000002' - tenant3 = 'ffffffffff0000000000000000000003' - - def setUp(self): - super(TestTenantQueue, self).setUp() - self.ssn = context.get_admin_context().session - - def test_add_del_tenant_queue(self): - ret = db_api.get_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertFalse(ret) # not found - ret = db_api.add_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertTrue(ret) # succeed - ret = db_api.add_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertFalse(ret) # already registered - ret = db_api.get_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertTrue(ret) # item found - ret = db_api.del_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertTrue(ret) # delete succeed - ret = db_api.del_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertFalse(ret) # do nothing - ret = db_api.get_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertFalse(ret) # not found - - def test_add_tenant_queue_no_result_found(self): - session = MagicMock() - session.query().filter().all.side_effect = NoResultFound - self.assertFalse( - db_api.add_nwa_tenant_queue(session, self.tenant1)) - - def test_add_tenant_queue_detail(self): - ret = db_api.add_nwa_tenant_queue( - self.ssn, self.tenant1, 'nwa_%s' % self.tenant1, topic='foo') - self.assertTrue(ret) - ret = db_api.get_nwa_tenant_queue(self.ssn, self.tenant1) - self.assertEqual(self.tenant1, ret.tenant_id) - self.assertEqual('nwa_%s' % self.tenant1, ret.nwa_tenant_id) - self.assertEqual('foo', ret.topic) - - ret = db_api.add_nwa_tenant_queue(self.ssn, self.tenant2) - self.assertTrue(ret) - ret = db_api.get_nwa_tenant_queue(self.ssn, self.tenant2) - self.assertEqual(self.tenant2, ret.tenant_id) - self.assertEqual('', ret.nwa_tenant_id) - self.assertEqual('', ret.topic) - - def test_get_tenant_queues(self): - ret = db_api.get_nwa_tenant_queues(self.ssn) - self.assertEqual(0, len(ret)) - - self.assertTrue(db_api.add_nwa_tenant_queue(self.ssn, self.tenant1)) - self.assertTrue(db_api.add_nwa_tenant_queue(self.ssn, self.tenant2)) - self.assertTrue(db_api.add_nwa_tenant_queue(self.ssn, self.tenant3)) - - ret = db_api.get_nwa_tenant_queues(self.ssn) - self.assertEqual(3, len(ret)) - - self.assertTrue(db_api.del_nwa_tenant_queue(self.ssn, self.tenant1)) - - ret = db_api.get_nwa_tenant_queues(self.ssn) - self.assertEqual(2, len(ret)) - - self.assertTrue(db_api.del_nwa_tenant_queue(self.ssn, self.tenant2)) - self.assertTrue(db_api.del_nwa_tenant_queue(self.ssn, self.tenant3)) - - ret = db_api.get_nwa_tenant_queues(self.ssn) - self.assertEqual(0, len(ret)) diff --git a/networking_nec/tests/unit/nwa/l2/test_models.py b/networking_nec/tests/unit/nwa/l2/test_models.py deleted file mode 100644 index 3f965f6..0000000 --- a/networking_nec/tests/unit/nwa/l2/test_models.py +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -# -*- mode: python; coding: utf-8 -*- -# GIT: $Id$ - -from neutron.tests import base - -from networking_nec.nwa.l2 import models - - -class TestNWATenantKeyValue(base.BaseTestCase): - def test_nwa_tenant_key_value(self): - ntkv = models.NWATenantKeyValue('T1', 'NWA-T1', 'key', 'value') - self.assertIsNotNone(ntkv) - self.assertEqual(str(ntkv), - "") - - -class TestNWATenantQueue(base.BaseTestCase): - def test_nwa_tenant_queue(self): - ntq = models.NWATenantQueue('T1', 'NWA-T1', 'topic-1') - self.assertIsNotNone(ntq) - self.assertEqual(str(ntq), - "") diff --git a/networking_nec/tests/unit/nwa/l2/test_plugin.py b/networking_nec/tests/unit/nwa/l2/test_plugin.py deleted file mode 100644 index 0463b85..0000000 --- a/networking_nec/tests/unit/nwa/l2/test_plugin.py +++ /dev/null @@ -1,238 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import MagicMock -from mock import patch -import six - -from neutron.common.test_lib import test_config -from neutron.tests import base -from oslo_config import cfg - -from networking_nec.nwa.l2 import plugin - - -class TestNECNWAL2Plugin(base.BaseTestCase): - - @patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin._setup_rpc') - @patch('neutron.plugins.ml2.managers.TypeManager.initialize') - def setUp(self, f1, f2): - super(TestNECNWAL2Plugin, self).setUp() - l3_plugin = ('neutron.tests.unit.test_l3_plugin.' - 'TestL3NatServicePlugin') - - service_plugins = {'l3_plugin_name': l3_plugin} - - cfg.CONF.set_override( - 'service_plugins', - [test_config.get(key, default) - for key, default in six.iteritems(service_plugins or {})] - ) - - f1.return_value = None - f2.return_value = None - - self.l2_plugin = plugin.NECNWAL2Plugin() - - def test_extend_network_dict_providor_no_id(self): - context = MagicMock() - network = {} - - result = self.l2_plugin._extend_network_dict_provider(context, - network) - - self.assertIsNone(result) - - @patch('neutron.db.segments_db.get_network_segments') - def test_extend_network_dict_provider_segment_none(self, f1): - context = MagicMock() - network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} - f1.return_value = None - - result = self.l2_plugin._extend_network_dict_provider(context, - network) - self.assertIsNone(result) - - @patch('neutron.db.segments_db.get_network_segments') - def test_extend_network_dict_provider_segment_one(self, f1): - context = MagicMock() - network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} - f1.return_value = [{'segmentation_id': 1000, - 'network_type': 'vlan', - 'physical_network': 'OpenStack/DC1/APP'}] - - result = self.l2_plugin._extend_network_dict_provider(context, - network) - self.assertIsNone(result) - - @patch('neutron.db.segments_db.get_network_segments') - def test_extend_network_dict_provider_segment_multi(self, f1): - context = MagicMock() - network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} - f1.return_value = [{'segmentation_id': 1000, - 'network_type': 'vlan', - 'physical_network': 'OpenStack/DC1/APP'}, - {'segmentation_id': 1001, - 'network_type': 'vlan', - 'physical_network': 'OpenStack/DC1/APP'}] - - result = self.l2_plugin._extend_network_dict_provider(context, - network) - self.assertIsNone(result) - - @patch('neutron.common.rpc.Connection.create_consumer') - def test_start_rpc_listeners(self, f1): - self.l2_plugin.notifier = MagicMock() - self.l2_plugin.type_manager = MagicMock() - self.l2_plugin.start_rpc_listeners() - - @patch('neutron.db.db_base_plugin_common.' - 'DbBasePluginCommon._make_network_dict') - @patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._extend_network_dict_provider') - @patch('neutron.plugins.ml2.plugin.Ml2Plugin.get_network') - def test_get_network(self, f1, f2, f3): - id = "99f771b4-af69-45cc-942f-a76be4e8cd1d" - context = MagicMock() - fields = MagicMock() - self.l2_plugin.get_network(context, id, fields) - - @patch('neutron.plugins.ml2.plugin.Ml2Plugin.get_networks') - def test_get_networks(self, f1): - context = MagicMock() - filters = MagicMock() - fields = MagicMock() - sorts = MagicMock() - limit = MagicMock() - marker = MagicMock() - page_reverse = False - result = self.l2_plugin.get_networks(context, filters, fields, - sorts, limit, marker, - page_reverse) - self.assertTrue(result) - - @patch('networking_nec.nwa.l2.db_api.get_nwa_tenant_queue') - @patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin._is_alive_nwa_agent') - def test_create_nwa_agent_tenant_queue(self, f1, f2): - context = MagicMock() - tid = 'Tenant1' - f1.return_value = True - f2.return_value = None - self.l2_plugin._create_nwa_agent_tenant_queue(context, tid) - - def test_create_nwa_agent_tenant_queue_not_alive(self): - context = MagicMock() - tid = 'Tenant1' - self.l2_plugin._create_nwa_agent_tenant_queue(context, tid) - - @patch('neutron.plugins.ml2.plugin.Ml2Plugin.delete_network') - @patch('networking_nec.nwa.l2.plugin.' - 'NECNWAL2Plugin._create_nwa_agent_tenant_queue') - @patch('neutron.plugins.ml2.plugin.Ml2Plugin.create_network') - def test_create_delete_network(self, f1, f2, f3): - context = MagicMock() - context.tenant_id = 'Tenant1' - network = {'id': '99f771b4-af69-45cc-942f-a76be4e8cd1d'} - - result = self.l2_plugin.create_network(context, network) - - self.assertTrue(result) - - result = self.l2_plugin.delete_network(context, result.id) - - self.assertTrue(result) - - @patch('neutron.plugins.ml2.plugin.Ml2Plugin.create_port') - def test_create_port(self, f1): - context = MagicMock() - port = MagicMock() - - result = self.l2_plugin.create_port(context, port) - self.assertTrue(result) - - @patch('networking_nec.nwa.l2.rpc.nwa_agent_api.' - 'NECNWAAgentApi.get_nwa_rpc_servers') - def test_get_nwa_topics(self, f1): - context = MagicMock() - id = 'Tenant1' # Tenant ID - f1.return_value = {'nwa_rpc_servers': - [{'tenant_id': 'Tenant1', 'topic': 'topic1'}, - {'tenant_id': 'Tenant2', 'topic': 'topic2'}, - {'tenant_id': 'Tenant1', 'topic': 'topic11'}]} - - result = self.l2_plugin.get_nwa_topics(context, id) - self.assertEqual(len(result), 2) - - @patch('networking_nec.nwa.l2.rpc.nwa_agent_api.' - 'NECNWAAgentApi.get_nwa_rpc_servers') - def test_get_nwa_topics_not_dict(self, f1): - context = MagicMock() - id = 'Tenant1' # Tenant ID - f1.return_value = ['topic1', 'topic2'] # not dict - - result = self.l2_plugin.get_nwa_topics(context, id) - self.assertEqual(len(result), 0) - - def test_get_nwa_proxy(self): - tid = 'Tenant1' - result = self.l2_plugin.get_nwa_proxy(tid) - - self.assertTrue(result) - - def test_get_nwa_proxy_in_nwa_proxies(self): - tid = 'Tenant1' - proxy = MagicMock() - self.l2_plugin.nwa_proxies = {tid: proxy} - result = self.l2_plugin.get_nwa_proxy(tid) - - self.assertEqual(result, proxy) - - @patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin.get_nwa_topics') - def test_get_nwa_proxy_with_context(self, f1): - tid = 'Tenant1' - context = MagicMock() - f1.return_value = ['topic1'] - result = self.l2_plugin.get_nwa_proxy(tid, context) - - self.assertTrue(result) - - @patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin.get_nwa_topics') - def test_get_nwa_proxy_no_topics(self, f1): - tid = 'Tenant1' - context = MagicMock() - f1.return_value = [] - result = self.l2_plugin.get_nwa_proxy(tid, context) - - self.assertTrue(result) - - @patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin.get_agents') - def test_is_alive_nwa_agent(self, f1): - context = MagicMock() - f1.return_value = [{'alive': True}, {'alive': False}] - - result = self.l2_plugin._is_alive_nwa_agent(context) - self.assertTrue(result) - - @patch('networking_nec.nwa.l2.plugin.NECNWAL2Plugin.get_agents') - def test_is_alive_nwa_agent_not_alive(self, f1): - context = MagicMock() - f1.return_value = [{'alive': False}] - - result = self.l2_plugin._is_alive_nwa_agent(context) - self.assertFalse(result) - - def test_get_port_from_device(self): - context = MagicMock() - device = 'device' - self.l2_plugin.get_port_from_device(context, device) diff --git a/networking_nec/tests/unit/nwa/l2/test_utils.py b/networking_nec/tests/unit/nwa/l2/test_utils.py deleted file mode 100644 index 83d880c..0000000 --- a/networking_nec/tests/unit/nwa/l2/test_utils.py +++ /dev/null @@ -1,359 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import MagicMock -from sqlalchemy.orm import exc as sa_exc - -from neutron.tests import base -from oslo_config import cfg -from oslo_serialization import jsonutils - -from networking_nec.nwa.l2 import utils as nwa_l2_utils - - -class TestNwa(base.BaseTestCase): - def setUp(self): - super(TestNwa, self).setUp() - - class network_context(object): - network = MagicMock() - current = MagicMock() - _plugin = MagicMock() - _plugin_context = MagicMock() - - class db_session(object): - def query(self): - return - pass - - class network_segment(object): - id = '1' - network_id = 0 - network_type = 'vlan' - physical_network = 'Phys1' - segmentation_id = '1001' - - def __init__(self, id_, nid, ntype, physnet, vid): - self.id = id_ - self.network_id = nid - self.network_type = ntype - self.physical_network = physnet - self.segmentation_id = vid - - self.context = network_context() - self.context.network.current = {} - self.context.network.current['tenant_id'] = 'T1' - self.context.network.current['name'] = 'PublicVLAN_100' - self.context.network.current['id'] = 'Uuid-PublicVLAN_100' - self.context._port = { - 'id': 'uuid-port-100', - 'device_owner': 'network:router_interface', - 'device_id': 'uuid-device_id_100', - 'fixed_ips': [ - {'ip_address': '192.168.120.1', - 'subnet_id': 'Uuid-Subnet-Id-1'} - ], - 'mac_address': '12:34:56:78:9a:bc' - } - self.host_agent = [ - { - "binary": "neutron-openvswitch-agent", - "description": None, - "admin_state_up": True, - "alive": True, - "topic": "N/A", - "host": "harry", - "agent_type": "Open vSwitch agent", - "id": "a01dc42f-0d15-43ff-8f80-22e15cfe715d", - "configurations": { - "tunnel_types": [], - "tunneling_ip": "", - "bridge_mappings": { - "Common/App/Pod3": "br-eth1" - }, - "l2_population": False, - "devices": 0 - } - }, - { - "alive": False - } - ] - - self.context.host_agents = MagicMock(return_value=self.host_agent) - self.context.current = {} - - self.network_segments = [ - { - "physical_network": "Common/KVM/Pod1-1", - "id": "uuid-1-1", - "segmentation_id": '100' - }, - { - "physical_network": "Common/KVM/Pod1-2", - "id": "uuid-1-2", - "segmentation_id": '101' - }, - { - "physical_network": "Common/App/Pod3", - "id": "uuid-1-3", - "segmentation_id": '102' - } - ] - - self.segments_db = [] - for segment in self.network_segments: - self.segments_db.append(network_segment( - self.context.network.current['id'], - segment['id'], 'vlan', - segment['physical_network'], segment['segmentation_id'])) - - self.resource_group = [ - { - "physical_network": "Common/BM/Pod1-1", - "device_owner": "compute:BM_AZ1", - "ResourceGroupName": "Common/BM/Pod1" - }, - { - "physical_network": "Common/KVM/Pod1-1", - "device_owner": "compute:AZ1", - "ResourceGroupName": "Common/KVM/Pod1" - }, - { - "physical_network": "Common/KVM/Pod1-2", - "device_owner": "compute:AZ2", - "ResourceGroupName": "Common/KVM/Pod2" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": "compute:DC01_BMT01_ZONE01", - "ResourceGroupName": "Common/App/Pod3" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": "ironic:isolation", - "ResourceGroupName": "Common/App/Pod3" - }, - { - "physical_network": "Common/App/Pod3", - "device_owner": "network:dhcp", - "ResourceGroupName": "Common/App/Pod3" - }, - { - "physical_network": "Common/App/Pod4", - "device_owner": "network:router_gateway", - "ResourceGroupName": "Common/App/Pod4" - }, - { - "physical_network": "Common/App/Pod4", - "device_owner": "network:router_interface", - "ResourceGroupName": "Common/App/Pod4" - } - ] - - fn_resource_group = self.get_temp_file_path('resource_group.json') - with open(fn_resource_group, 'w') as f: - f.write(jsonutils.dumps(self.resource_group)) - cfg.CONF.set_override('resource_group_file', fn_resource_group, - group='NWA') - - self.nwa_data = {} - self.jbody = { - 'resultdata': { - 'ResourceGroupName': 'Common/App/Pod3', - 'VlanID': '2015', - 'TenantID': 'TenantID-2015', - 'TenantFWName': 'TFW2015', - 'LogicalNWName': 'PublicVLAN_2015' - } - } - self.rcode = MagicMock() - - -class TestGetNetworkInfo(TestNwa): - def test_get_network_info(self): - net, nid = nwa_l2_utils.get_network_info(self.context) - self.assertEqual(net, 'PublicVLAN_100') - self.assertEqual(nid, 'Uuid-PublicVLAN_100') - - -class TestGetPhysicalNetwork(TestNwa): - def test_get_physical_network(self): - pnet = nwa_l2_utils.get_physical_network('compute:AZ1', - self.resource_group) - self.assertEqual(pnet, 'Common/KVM/Pod1-1') - - pnet = nwa_l2_utils.get_physical_network('compute:AZ1', - self.resource_group, - 'Common/KVM/Pod1') - self.assertEqual(pnet, 'Common/KVM/Pod1-1') - - def test_get_physical_network_not_found(self): - pnet = nwa_l2_utils.get_physical_network('network:router_interface1', - self.resource_group) - self.assertIsNone(pnet) - - pnet = nwa_l2_utils.get_physical_network('compute:AZ1', - self.resource_group, - 'Common/KVM/Pod2') - self.assertIsNone(pnet) - - -class TestGetVlanIdOfPhysicalNetwork(TestNwa): - def test_segment_not_found(self): - network_id = 'uuid-1-2' - physical_network = 'Common/KVM/Pod1-2' - self.context.network.session = MagicMock() - self.context.network.session.query().filter().order_by().filter_by().\ - all.return_value = [] - vid = nwa_l2_utils.get_vlan_id_of_physical_network( - self.context.network, network_id, physical_network) - self.assertEqual(vid, '') - - def test_physical_network_not_found(self): - network_id = 'uuid-1-2' - physical_network = 'Common/KVM/Pod1-X' - self.context.network.session = MagicMock() - self.context.network.session.query().filter().order_by().filter_by().\ - all.return_value = [self.segments_db[1]] - vid = nwa_l2_utils.get_vlan_id_of_physical_network( - self.context.network, network_id, physical_network) - self.assertEqual(vid, '101') - - def test_found(self): - network_id = 'uuid-1-2' - physical_network = 'Common/KVM/Pod1-2' - self.context.network.session = MagicMock() - self.context.network.session.query().filter().order_by().filter_by().\ - all.return_value = [self.segments_db[1]] - vid = nwa_l2_utils.get_vlan_id_of_physical_network( - self.context.network, network_id, physical_network) - self.assertEqual(vid, '101') - - -class TestPortcontextToNwaInfo(TestNwa): - def test_portcontext_to_nwa_info(self): - self.context.current = self.context._port - rd = nwa_l2_utils.portcontext_to_nwa_info(self.context, - self.resource_group) - self.assertIsInstance(rd, dict) - p = self.context._port - self.assertEqual(rd['device']['owner'], p['device_owner']) - self.assertEqual(rd['device']['id'], p['device_id']) - self.assertEqual(rd['subnet']['id'], p['fixed_ips'][0]['subnet_id']) - self.assertEqual(rd['port']['id'], p['id']) - self.assertEqual(rd['port']['ip'], p['fixed_ips'][0]['ip_address']) - self.assertEqual(rd['port']['mac'], p['mac_address']) - c = self.context.network.current - self.assertEqual(rd['network']['id'], c['id']) - self.assertEqual(rd['network']['name'], c['name']) - self.assertEqual(rd['network']['vlan_type'], 'PublicVLAN') - self.assertEqual(rd['network']['vlan_id'], '') - - def test_portcontext_to_nwa_info_business_vlan(self): - # session in context - self.context.session = MagicMock() - # external network is not found - self.context.session.query().filter_by().\ - one.side_effect = sa_exc.NoResultFound - self.context.network.current['name'] = 'BusinessVLAN_200' - self.context.network.current['id'] = 'Uuid-BusinessVLAN_200' - self.context.current = self.context._port - rd = nwa_l2_utils.portcontext_to_nwa_info(self.context, - self.resource_group) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['network']['vlan_type'], 'BusinessVLAN') - - def test_portcontext_to_nwa_info_original_port(self): - device_owner = 'do-1' - device_id = 'di-1' - id_ = 'id-1' - subnet_id = 'sid-1' - ip_address = '192.168.120.1' - mac = 'mac-1' - self.context.original = { - 'device_owner': device_owner, - 'device_id': device_id, - 'id': id_, - 'fixed_ips': [ - {'ip_address': ip_address, - 'subnet_id': subnet_id}, - ], - 'mac_address': mac, - } - rd = nwa_l2_utils.portcontext_to_nwa_info(self.context, - self.resource_group, - True) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['device']['owner'], device_owner) - self.assertEqual(rd['device']['id'], device_id) - self.assertEqual(rd['subnet']['id'], subnet_id) - self.assertEqual(rd['port']['id'], id_) - self.assertEqual(rd['port']['ip'], ip_address) - self.assertEqual(rd['port']['mac'], mac) - - def test_portcontext_to_nwa_info_original_port_no_fixedip(self): - device_owner = 'do-2' - device_id = 'di-2' - id_ = 'id-2' - subnet_id = '' - ip_address = '' - mac = '' - self.context.original = { - 'device_owner': device_owner, - 'device_id': device_id, - 'id': id_, - 'fixed_ips': [], - 'mac_address': mac, - } - rd = nwa_l2_utils.portcontext_to_nwa_info(self.context, - self.resource_group, - True) - self.assertIsInstance(rd, dict) - self.assertEqual(rd['device']['owner'], device_owner) - self.assertEqual(rd['device']['id'], device_id) - self.assertEqual(rd['subnet']['id'], subnet_id) - self.assertEqual(rd['port']['id'], id_) - self.assertEqual(rd['port']['ip'], ip_address) - self.assertEqual(rd['port']['mac'], mac) - - -class test__getResourceGroupName(TestNwa): - def test__get_resource_group_name(self): - self.context.current['device_owner'] = 'network:dhcp' - rc = nwa_l2_utils._get_resource_group_name(self.context, - self.resource_group) - self.assertEqual(rc, 'Common/App/Pod3') - - self.context.current['device_owner'] = 'network:router_interface' - rc = nwa_l2_utils._get_resource_group_name(self.context, - self.resource_group) - self.assertEqual(rc, 'Common/App/Pod4') - - self.context.current['device_owner'] = 'network:router_gateway' - rc = nwa_l2_utils._get_resource_group_name(self.context, - self.resource_group) - self.assertEqual(rc, 'Common/App/Pod4') - - self.context.current['device_owner'] = 'compute:AZ1' - rc = nwa_l2_utils._get_resource_group_name(self.context, - self.resource_group) - self.assertIsNone(rc) - - self.context.current['device_owner'] = 'network:router_interface' - self.host_agent[0]['alive'] = False - self.resource_group = [] - rc = nwa_l2_utils._get_resource_group_name(self.context, - self.resource_group) - self.assertIsNone(rc) diff --git a/networking_nec/tests/unit/nwa/l3/__init__.py b/networking_nec/tests/unit/nwa/l3/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/l3/rpc/__init__.py b/networking_nec/tests/unit/nwa/l3/rpc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/l3/rpc/test_nwa_l3_proxy_api.py b/networking_nec/tests/unit/nwa/l3/rpc/test_nwa_l3_proxy_api.py deleted file mode 100644 index 7bde935..0000000 --- a/networking_nec/tests/unit/nwa/l3/rpc/test_nwa_l3_proxy_api.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from neutron.tests import base - -from networking_nec.nwa.l3.rpc.nwa_l3_proxy_api import NwaL3ProxyApi - - -class TestNwaL3ProxyApi(base.BaseTestCase): - - def setUp(self): - self.context = mock.ANY - self.tenant_id = 'T1' - self.nwa_tenant_id = 'DC1T1' - self.client = mock.MagicMock() - self.proxy = NwaL3ProxyApi(self.client) - super(TestNwaL3ProxyApi, self).setUp() - - def test_create_tenant_fw(self): - cctxt = mock.Mock() - self.client.prepare.return_value = cctxt - nwa_info1 = [{'a': 1}, {'b': 2}, {'c': 3}] - self.proxy.create_tenant_fw(self.context, self.tenant_id, - self.nwa_tenant_id, nwa_info1) - cctxt.cast.assert_called_with( - self.context, 'create_tenant_fw', - tenant_id=self.tenant_id, - nwa_tenant_id=self.nwa_tenant_id, - nwa_info=nwa_info1 - ) - - def test_delete_tenant_fw(self): - cctxt = mock.Mock() - self.client.prepare.return_value = cctxt - nwa_info2 = [{'a': 4}, {'b': 5}, {'c': 6}] - self.proxy.delete_tenant_fw(self.context, self.tenant_id, - self.nwa_tenant_id, nwa_info2) - cctxt.cast.assert_called_with( - self.context, 'delete_tenant_fw', - tenant_id=self.tenant_id, - nwa_tenant_id=self.nwa_tenant_id, - nwa_info=nwa_info2 - ) - - def test_setting_nat(self): - cctxt = mock.Mock() - self.client.prepare.return_value = cctxt - floating1 = [{'x': 1}, {'y': 2}, {'z': 3}] - self.proxy.setting_nat(self.context, self.tenant_id, - self.nwa_tenant_id, floating1) - cctxt.cast.assert_called_with( - self.context, 'setting_nat', - tenant_id=self.tenant_id, - nwa_tenant_id=self.nwa_tenant_id, - floating=floating1 - ) - - def test_delete_nat(self): - cctxt = mock.Mock() - self.client.prepare.return_value = cctxt - floating2 = [{'x': 4}, {'y': 5}, {'z': 6}] - self.proxy.delete_nat(self.context, self.tenant_id, - self.nwa_tenant_id, floating2) - cctxt.cast.assert_called_with( - self.context, 'delete_nat', - tenant_id=self.tenant_id, - nwa_tenant_id=self.nwa_tenant_id, - floating=floating2 - ) diff --git a/networking_nec/tests/unit/nwa/l3/test_plugin.py b/networking_nec/tests/unit/nwa/l3/test_plugin.py deleted file mode 100644 index cb0b6eb..0000000 --- a/networking_nec/tests/unit/nwa/l3/test_plugin.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import MagicMock -from mock import patch -from sqlalchemy.orm import exc as sa_exc - -from neutron.tests import base -from neutron_lib import exceptions as n_exc - -from networking_nec.nwa.l3.plugin import NECNWAL3Plugin - - -class TestNECNWAL3Plugin(base.BaseTestCase): - - @patch('neutron.services.l3_router.l3_router_plugin.' - 'L3RouterPlugin.__init__') - def setUp(self, l3p): - super(TestNECNWAL3Plugin, self).setUp() - self.plg = NECNWAL3Plugin() - self.context = MagicMock() - self.floating = { - 'floating_ip_address': '172.16.0.107', - 'fixed_ip_address': '192.168.120.107', - 'router_id': 'uuid-router_id-107', - 'floating_network_id': 'uuid-network_id-107', - 'tenant_id': 'T-107', - 'floating_port_id': 'uuid-floating_port_id-107', - } - - @patch('neutron.db.l3_db.L3_NAT_db_mixin.create_floatingip') - def test_create_floatingip(self, cfip): - floatingip = MagicMock() - cfip.return_value = 0 - rc = self.plg.create_floatingip(self.context, floatingip) - self.assertEqual(rc, 0) - - @patch('neutron.db.l3_db.L3_NAT_db_mixin.update_floatingip') - @patch('networking_nec.nwa.l3_plugin.NECNWAL3Plugin._delete_nat') - @patch('neutron.services.l3_router.l3_router_plugin.' - 'L3RouterPlugin.update_floatingip') - def _test_update_floatingip(self, ufip, ndn, nsn): - floatingip = { - 'floatingip': { - 'port_id': None - } - } - fid = 'uuid-fid-100' - ufip.return_value = 0 - self.context.session.query().filter_by().one.return_value = \ - self.floating - rc = self.plg.update_floatingip(self.context, fid, floatingip) - self.assertEqual(rc, 0) - - floatingip = { - 'floatingip': { - 'port_id': 'uuid-port_id-101' - } - } - rc = self.plg.update_floatingip(self.context, fid, floatingip) - self.assertEqual(rc, 0) - - floatingip = { - 'floatingip': { - 'port_id1': 'uuid-port_id-102' - } - } - rc = self.plg.update_floatingip(self.context, fid, floatingip) - self.assertEqual(rc, 0) - - def test_update_floatingip_raise_before_super_call(self): - floatingip = { - 'floatingip': { - 'port_id': None - } - } - fid = 'uuid-fid-111' - self.context.session.query().filter_by().one.side_effect = \ - sa_exc.NoResultFound - self.assertRaises( - n_exc.PortNotFound, - self.plg.update_floatingip, self.context, fid, floatingip - ) - - @patch('neutron.services.l3_router.l3_router_plugin.' - 'L3RouterPlugin.update_floatingip') - def _test_update_floatingip_raise_after_super_call(self, uifp): - floatingip = { - 'floatingip': { - 'port_id': 'uuid-port_id_112' - } - } - fid = 'uuid-fid-112' - self.context.session.query().filter_by().one.side_effect = \ - sa_exc.NoResultFound - self.assertRaises( - n_exc.PortNotFound, - self.plg.update_floatingip, self.context, fid, floatingip - ) diff --git a/networking_nec/tests/unit/nwa/nwalib/__init__.py b/networking_nec/tests/unit/nwa/nwalib/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/networking_nec/tests/unit/nwa/nwalib/test_client.py b/networking_nec/tests/unit/nwa/nwalib/test_client.py deleted file mode 100644 index 3fd5032..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_client.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from mock import patch -from neutron.tests import base - -from networking_nec.nwa.nwalib import client - - -class TestNwaClientBase(base.BaseTestCase): - - def setUp(self): - super(TestNwaClientBase, self).setUp() - host = '127.0.0.1' - port = '12081' - access_key_id = 'PzGIIoLbL7ttHFkDHqLguFz/7+VsVJbDmV0iLWAkJ0g=' - secret_access_key = 'nbvX65iujFoYomXTKROF9GKUN6L2rAM/sI+cvNdW7sw=' - - self.nwa = client.NwaClient( - host=host, port=port, access_key_id=access_key_id, - secret_access_key=secret_access_key, - load_workflow_list=False - ) - self.nwa.workflow_first_wait = 0 - - wki = patch('networking_nec.nwa.nwalib.nwa_restclient.' - 'NwaRestClient.workflowinstance').start() - wki.return_value = (200, {'status': 'SUCCESS'}) - - self.post = patch('networking_nec.nwa.nwalib.restclient.' - 'RestClient.post').start() - self.post.__name__ = 'post' - self.post.return_value = (200, {'status': 'SUCCESS', - 'executionid': "01"}) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_client_fwaas.py b/networking_nec/tests/unit/nwa/nwalib/test_client_fwaas.py deleted file mode 100644 index cb70e8c..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_client_fwaas.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -from networking_nec.nwa.nwalib import workflow -from networking_nec.tests.unit.nwa.nwalib import test_client - -TENANT_ID = 'OpenT9004' - - -class TestNwaClientFWaaS(test_client.TestNwaClientBase): - - def test_setting_fw_policy(self): - fw_name = 'TFW8' - props = {'properties': [1]} - rd, rj = self.nwa.fwaas.setting_fw_policy_async( - TENANT_ID, fw_name, props - ) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('SettingFWPolicy'), - {'TenantID': TENANT_ID, - 'DCResourceType': 'TFW_Policy', - 'DCResourceOperation': 'Setting', - 'DeviceInfo': {'Type': 'TFW', 'DeviceName': fw_name}, - 'Property': props}) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_client_l2.py b/networking_nec/tests/unit/nwa/nwalib/test_client_l2.py deleted file mode 100644 index 4ec4f13..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_client_l2.py +++ /dev/null @@ -1,258 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import testscenarios - -from networking_nec.nwa.nwalib import workflow -from networking_nec.tests.unit.nwa.nwalib import test_client - -TENANT_ID = 'OpenT9004' -DC_RESOURCE_GROUP_POD1 = 'OpenStack/DC1/Common/Pod1Grp/Pod1' -DC_RESOURCE_GROUP_APP1 = 'OpenStack/DC1/Common/App1Grp/App1' - - -class TestNwaClientL2Scenario(testscenarios.WithScenarios, - test_client.TestNwaClientBase): - - scenarios = [ - ('test 1', - {'operations': [ - ('delete', 'vlan-A'), - ('delete', 'vlan-B'), - ('delete', 'vlan-C'), - ('delete', 'vlan-D'), - ('delete', 'vlan-A') - ]}), - ('test 2', - {'operations': [ - ('delete', 'vlan-1'), - ('delete', 'vlan-2'), - ('delete', 'vlan-3'), - ('delete', 'vlan-1') - ]}), - # delete to "create" - ('test 3', - {'operations': [ - ('create', 'vlan-A'), - ('delete', 'vlan-A'), - ('create', 'vlan-A')]}), - # don't delete if name is not same. - ('test 4', - {'operations': [ - ('create', 'vlan-1'), - ('delete', 'vlan-2'), - ('create', 'vlan-1') - ]}), - ('test 5', - {'operations': [ - ('create', 'vlan-B'), - ('delete', 'vlan-B'), - ('create', 'vlan-C') - ]}), - ('test 6', - {'operations': [ - ('create', 'vlan-X'), - ('delete', 'vlan-X'), - ('create', 'vlan-X'), - ('delete', 'vlan-X') - ]}), - ('test 7', - {'operations': [ - ('create', 'vlan-1'), - ('create', 'vlan-2'), - ('delete', 'vlan-1'), - ('delete', 'vlan-2'), - ('create', 'vlan-1'), - ('delete', 'vlan-1') - ]}), - ('test 8', - {'operations': [ - ('create', 'vlan-E'), - ('delete', 'vlan-E'), - ('delete', 'vlan-E'), - ('delete', 'vlan-E') - ]}), - ] - - def test_general_dev(self): - dcresgrp_name = 'Common/App/Pod3' - for operation, vlan_name in self.operations: - method = getattr(self.nwa.l2, '%s_general_dev' % operation) - rd, rj = method(TENANT_ID, dcresgrp_name, vlan_name) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, len(self.operations)) - - -class TestNwaClientL2(test_client.TestNwaClientBase): - - def test_create_tenant_nw(self): - rd, rj = self.nwa.l2.create_tenant_nw(TENANT_ID, - DC_RESOURCE_GROUP_APP1) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('CreateTenantNW'), - {'TenantID': TENANT_ID, - 'CreateNW_DCResourceGroupName': DC_RESOURCE_GROUP_APP1, - 'CreateNW_OperationType': 'CreateTenantNW'}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_delete_tenant_nw(self): - rd, rj = self.nwa.l2.delete_tenant_nw(TENANT_ID) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('DeleteTenantNW'), - {'TenantID': TENANT_ID}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_create_vlan(self): - vlan_type = 'BusinessVLAN' - ipaddr = '10.0.0.0' - mask = 24 - open_nid = 'UUID' - - rd, rj = self.nwa.l2.create_vlan( - TENANT_ID, ipaddr, mask, vlan_type, open_nid - ) - - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('CreateVLAN'), - {'TenantID': TENANT_ID, - 'CreateNW_IPSubnetMask1': mask, - 'CreateNW_IPSubnetAddress1': ipaddr, - 'CreateNW_VlanType1': vlan_type, - 'CreateNW_VlanLogicalID1': open_nid}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_create_vlan_without_open_nid(self): - vlan_type = 'BusinessVLAN' - ipaddr = '10.0.0.0' - mask = 24 - - rd, rj = self.nwa.l2.create_vlan( - TENANT_ID, ipaddr, mask, vlan_type - ) - - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('CreateVLAN'), - {'TenantID': TENANT_ID, - 'CreateNW_IPSubnetMask1': mask, - 'CreateNW_IPSubnetAddress1': ipaddr, - 'CreateNW_VlanType1': vlan_type}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_delete_vlan(self): - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - rd, rj = self.nwa.l2.delete_vlan( - TENANT_ID, vlan_name, vlan_type - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('DeleteVLAN'), - {'TenantID': TENANT_ID, - 'DeleteNW_VlanLogicalName1': vlan_name, - 'DeleteNW_VlanType1': vlan_type}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_create_general_dev(self): - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - port_type = 'BM' - rd, rj = self.nwa.l2.create_general_dev( - TENANT_ID, DC_RESOURCE_GROUP_POD1, - vlan_name, vlan_type, port_type, 'vlan-logical-id-1' - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('CreateGeneralDev'), - {'TenantID': TENANT_ID, - 'CreateNW_DeviceType1': 'GeneralDev', - 'CreateNW_DCResourceGroupName': DC_RESOURCE_GROUP_POD1, - 'CreateNW_VlanLogicalName1': vlan_name, - 'CreateNW_VlanType1': vlan_type, - 'CreateNW_PortType1': port_type, - 'CreateNW_VlanLogicalID1': 'vlan-logical-id-1'}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_delete_general_dev(self): - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - port_type = 'BM' - rd, rj = self.nwa.l2.delete_general_dev( - TENANT_ID, DC_RESOURCE_GROUP_POD1, - vlan_name, vlan_type, port_type, 'vlan-logical-id-2' - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('DeleteGeneralDev'), - {'TenantID': TENANT_ID, - 'DeleteNW_DeviceType1': 'GeneralDev', - 'DeleteNW_DCResourceGroupName': DC_RESOURCE_GROUP_POD1, - 'DeleteNW_VlanLogicalName1': vlan_name, - 'DeleteNW_VlanType1': vlan_type, - 'DeleteNW_PortType1': port_type, - 'DeleteNW_VlanLogicalID1': 'vlan-logical-id-2'}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_create_connect_port(self): - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - vlan_id = 1001 - rd, rj = self.nwa.l2.create_connect_port( - TENANT_ID, DC_RESOURCE_GROUP_POD1, - vlan_name, vlan_type, vlan_id - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('CreateConnectPort'), - {'CreateNW_DCResourceGroupName': DC_RESOURCE_GROUP_POD1, - 'CreateNW_DeviceType1': 'GeneralDev', - 'CreateNW_OperationType': 'CreateConnectPort', - 'CreateNW_VlanID1': vlan_id, - 'CreateNW_VlanLogicalName1': vlan_name, - 'CreateNW_VlanType1': vlan_type, - 'TenantID': TENANT_ID}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_delete_connect_port(self): - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - vlan_id = 1001 - rd, rj = self.nwa.l2.delete_connect_port( - TENANT_ID, DC_RESOURCE_GROUP_POD1, - vlan_name, vlan_type, vlan_id - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('DeleteConnectPort'), - {'DeleteNW_DCResourceGroupName': DC_RESOURCE_GROUP_POD1, - 'DeleteNW_DeviceType1': 'GeneralDev', - 'DeleteNW_OperationType': 'DeleteConnectPort', - 'DeleteNW_VlanID1': vlan_id, - 'DeleteNW_VlanLogicalName1': vlan_name, - 'DeleteNW_VlanType1': vlan_type, - 'TenantID': TENANT_ID}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_client_l3.py b/networking_nec/tests/unit/nwa/nwalib/test_client_l3.py deleted file mode 100644 index ccde652..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_client_l3.py +++ /dev/null @@ -1,169 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from networking_nec.nwa.nwalib import workflow -from networking_nec.tests.unit.nwa.nwalib import test_client - -TENANT_ID = 'OpenT9004' - -# create tenant nw -DC_RESOURCE_GROUP_APP1 = 'OpenStack/DC1/Common/App1Grp/App1' - - -class TestNwaClientL3(test_client.TestNwaClientBase): - - def test_create_tenant_fw(self): - vlan_devaddr = '10.0.0.254' - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - rd, rj = self.nwa.l3.create_tenant_fw( - TENANT_ID, DC_RESOURCE_GROUP_APP1, - vlan_devaddr, vlan_name, vlan_type - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('CreateTenantFW'), - {'TenantID': TENANT_ID, - 'CreateNW_DeviceType1': 'TFW', - 'CreateNW_DCResourceGroupName': DC_RESOURCE_GROUP_APP1, - 'CreateNW_Vlan_DeviceAddress1': vlan_devaddr, - 'CreateNW_VlanLogicalName1': vlan_name, - 'CreateNW_VlanType1': vlan_type}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_update_tenant_fw(self): - device_name = 'TFW0' - device_type = 'TFW' - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - rd, rj = self.nwa.l3.update_tenant_fw( - TENANT_ID, - device_name, mock.sentinel.vlan_devaddr, - vlan_name, vlan_type, 'connect' - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('UpdateTenantFW'), - {'TenantID': TENANT_ID, - 'ReconfigNW_DeviceName1': device_name, - 'ReconfigNW_DeviceType1': device_type, - 'ReconfigNW_VlanLogicalName1': vlan_name, - 'ReconfigNW_Vlan_DeviceAddress1': mock.sentinel.vlan_devaddr, - 'ReconfigNW_VlanType1': vlan_type, - 'ReconfigNW_Vlan_ConnectDevice1': 'connect'}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_update_tenant_fw_without_connect(self): - device_name = 'TFW0' - device_type = 'TFW' - vlan_name = 'LNW_BusinessVLAN_49' - vlan_type = 'BusinessVLAN' - rd, rj = self.nwa.l3.update_tenant_fw( - TENANT_ID, - device_name, mock.sentinel.vlan_devaddr, - vlan_name, vlan_type - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('UpdateTenantFW'), - {'TenantID': TENANT_ID, - 'ReconfigNW_DeviceName1': device_name, - 'ReconfigNW_DeviceType1': device_type, - 'ReconfigNW_VlanLogicalName1': vlan_name, - 'ReconfigNW_Vlan_DeviceAddress1': mock.sentinel.vlan_devaddr, - 'ReconfigNW_VlanType1': vlan_type}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_delete_tenant_fw(self): - device_name = 'TFW0' - device_type = 'TFW' - rd, rj = self.nwa.l3.delete_tenant_fw( - TENANT_ID, - device_name, device_type, - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('DeleteTenantFW'), - {'TenantID': TENANT_ID, - 'DeleteNW_DeviceName1': device_name, - 'DeleteNW_DeviceType1': device_type}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_setting_nat(self): - fw_name = 'TFW8' - vlan_name = 'LNW_PublicVLAN_46' - vlan_type = 'PublicVLAN' - local_ip = '172.16.0.2' - global_ip = '10.0.0.10' - rd, rj = self.nwa.l3.setting_nat( - TENANT_ID, - vlan_name, vlan_type, local_ip, global_ip, fw_name - ) - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('SettingNAT'), - {'TenantID': TENANT_ID, - 'ReconfigNW_VlanLogicalName1': vlan_name, - 'ReconfigNW_VlanType1': vlan_type, - 'ReconfigNW_DeviceType1': 'TFW', - 'ReconfigNW_DeviceName1': fw_name, - 'LocalIP': local_ip, - 'GlobalIP': global_ip}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_delete_nat(self): - fw_name = 'TFW8' - vlan_name = 'LNW_PublicVLAN_46' - vlan_type = 'PublicVLAN' - local_ip = '172.16.0.2' - global_ip = '10.0.0.10' - - rd, rj = self.nwa.l3.delete_nat( - TENANT_ID, - vlan_name, vlan_type, local_ip, global_ip, fw_name - ) - - self.post.assert_called_once_with( - workflow.NwaWorkflow.path('DeleteNAT'), - {'TenantID': TENANT_ID, - 'DeleteNW_VlanLogicalName1': vlan_name, - 'DeleteNW_VlanType1': vlan_type, - 'DeleteNW_DeviceType1': 'TFW', - 'DeleteNW_DeviceName1': fw_name, - 'LocalIP': local_ip, - 'GlobalIP': global_ip}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def test_update_nat(self): - fw_name = 'TFW8' - vlan_name = 'LNW_PublicVLAN_46' - vlan_type = 'PublicVLAN' - local_ip = '172.16.0.2' - global_ip = '10.0.0.10' - rd, rj = self.nwa.l3.update_nat( - TENANT_ID, - vlan_name, vlan_type, local_ip, global_ip, fw_name - ) - - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 2) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_client_tenant.py b/networking_nec/tests/unit/nwa/nwalib/test_client_tenant.py deleted file mode 100644 index c2b3e28..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_client_tenant.py +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock - -from networking_nec.tests.unit.nwa.nwalib import test_client - -TENANT_ID = 'OpenT9004' -DC_RESOURCE_GROUP_POD1 = 'OpenStack/DC1/Common/Pod1Grp/Pod1' -DC_RESOURCE_GROUP_APP1 = 'OpenStack/DC1/Common/App1Grp/App1' - - -class TestNwaClientTenant(test_client.TestNwaClientBase): - - def test_create_tenant(self): - rd, rj = self.nwa.tenant.create_tenant(TENANT_ID) - self.post.assert_called_once_with( - '/umf/tenant/%s' % TENANT_ID, - {'TenantName': TENANT_ID}) - self.assertEqual(rd, 200) - self.assertEqual(rj['status'], 'SUCCESS') - self.assertEqual(self.post.call_count, 1) - - def _test_delete_tenant(self, status_code, sem_delete_tenant_called): - with mock.patch('networking_nec.nwa.nwalib.restclient.' - 'RestClient.delete') as mock_delete, \ - mock.patch('networking_nec.nwa.nwalib.semaphore.' - 'Semaphore.delete_tenant_semaphore') as mock_sem_del: - mock_delete.return_value = (status_code, mock.sentinel.data) - rd, rj = self.nwa.tenant.delete_tenant(TENANT_ID) - - mock_delete.assert_called_once_with('/umf/tenant/%s' % TENANT_ID) - if sem_delete_tenant_called: - mock_sem_del.assert_called_once_with(TENANT_ID) - else: - self.assertEqual(0, mock_sem_del.call_count) - self.assertEqual(rd, status_code) - self.assertEqual(mock.sentinel.data, rj) - self.assertEqual(0, self.post.call_count) - self.assertEqual(1, mock_delete.call_count) - - def test_delete_tenant(self): - self._test_delete_tenant(200, sem_delete_tenant_called=True) - - def test_delete_tenant_non_200(self): - self._test_delete_tenant(500, sem_delete_tenant_called=False) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_exceptions.py b/networking_nec/tests/unit/nwa/nwalib/test_exceptions.py deleted file mode 100644 index b707201..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_exceptions.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.nwalib import exceptions as nwa_exc - - -class TestNwaException(base.BaseTestCase): - def test___str__(self): - exc = nwa_exc.NwaException(200, 'msg1', mock.MagicMock()) - self.assertEqual(str(exc), 'http status: 200, msg1') diff --git a/networking_nec/tests/unit/nwa/nwalib/test_nwa_restclient.py b/networking_nec/tests/unit/nwa/nwalib/test_nwa_restclient.py deleted file mode 100644 index 0f47258..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_nwa_restclient.py +++ /dev/null @@ -1,237 +0,0 @@ -# Copyright 2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base -from oslo_config import cfg - -from networking_nec.nwa.nwalib import exceptions as nwa_exc -from networking_nec.nwa.nwalib import nwa_restclient - -TENANT_ID = 'OpenT9004' - - -class TestNwaRestClient(base.BaseTestCase): - - def test_get_client_with_host_port(self): - client = nwa_restclient.NwaRestClient('127.0.0.1', 8080, True) - self.assertEqual('127.0.0.1', client.host) - self.assertEqual(8080, client.port) - self.assertIs(True, client.use_ssl) - - def test_get_client_with_url(self): - cfg.CONF.set_override('server_url', 'http://127.0.0.1:8888', - group='NWA') - client = nwa_restclient.NwaRestClient() - self.assertEqual('127.0.0.1', client.host) - self.assertEqual(8888, client.port) - self.assertIs(False, client.use_ssl) - - def test_get_client_with_url_with_https(self): - cfg.CONF.set_override('server_url', 'https://192.168.1.1:8080', - group='NWA') - client = nwa_restclient.NwaRestClient() - self.assertEqual('192.168.1.1', client.host) - self.assertEqual(8080, client.port) - self.assertIs(True, client.use_ssl) - - def test_get_client_with_no_parameter(self): - self.assertRaises(cfg.Error, nwa_restclient.NwaRestClient) - - def test_get_client_auth_function(self): - cfg.CONF.set_override('access_key_id', - '5g2ZMAdMwZ1gQqZagNqbJSrlopQUAUHILcP2nmxVs28=', - group='NWA') - cfg.CONF.set_override('secret_access_key', - 'JE35Lup5CvI68lneFS4EtSGCh1DnG8dBtTRycPQ83QA=', - group='NWA') - client = nwa_restclient.NwaRestClient('127.0.0.1', 8080, True) - self.assertEqual( - client.auth( - 'Wed, 11 Feb 2015 17:24:51 GMT', - '/umf/tenant/DC1' - ), - b'SharedKeyLite 5g2ZMAdMwZ1gQqZagNqbJSrlopQUAUHILcP2nmxVs28=' - b':mNd/AZJdMawfhJpVUT/lQcH7fPMz+4AocKti1jD1lCI=' - ) - - def test_get_client_auth_function_with_parameters(self): - client = nwa_restclient.NwaRestClient('127.0.0.1', 8080, True, - access_key_id='user', - secret_access_key='password') - self.assertEqual( - client.auth( - 'Wed, 11 Feb 2015 17:24:51 GMT', - '/umf/tenant/DC1' - ), - b'SharedKeyLite user:d7ym8ADuKFoIphXojb1a36lvMb5KZK7fPYKz7RlDcpw=' - ) - - @mock.patch('networking_nec.nwa.nwalib.restclient.RestClient.rest_api') - def test_rest_api_return_check(self, ra): - client = nwa_restclient.NwaRestClient('127.0.0.5', 8085, False) - - body = {'a': 1} - url = '/path' - ra.return_value = (200, None) - hst, rd = client.rest_api('GET', url, body) - self.assertEqual(hst, 200) - self.assertIsNone(rd) - - failed = { - 'status': 'FAILED', 'progress': '100' - } - ra.return_value = (200, failed) - client.post_data = url, body - hst, rd = client.rest_api('GET', url, body) - self.assertEqual(hst, 200) - self.assertEqual(rd, failed) - - ra.side_effect = nwa_exc.NwaException(200, 'msg1', None) - hst, rd = client.rest_api('GET', url, body) - self.assertEqual(hst, 200) - self.assertIsNone(rd) - - @mock.patch('requests.request') - def test_rest_api_raise(self, rr): - def myauth(a, b): - pass - - rr.side_effect = OSError - rcl = nwa_restclient.NwaRestClient('127.0.0.3', 8083, True, myauth) - body = {'a': 1} - url = 'http://127.0.0.5:8085/path' - self.assertRaises( - OSError, - rcl.rest_api, 'GET', url, body - ) - - -class TestNwaRestClientWorkflow(base.BaseTestCase): - - def setUp(self): - super(TestNwaRestClientWorkflow, self).setUp() - host = '127.0.0.1' - port = '12081' - access_key_id = 'PzGIIoLbL7ttHFkDHqLguFz/7+VsVJbDmV0iLWAkJ0g=' - secret_access_key = 'nbvX65iujFoYomXTKROF9GKUN6L2rAM/sI+cvNdW7sw=' - - self.nwa = nwa_restclient.NwaRestClient( - host=host, port=port, access_key_id=access_key_id, - secret_access_key=secret_access_key - ) - self.nwa.workflow_first_wait = 0 - - def test_get_client_workflow_parameters(self): - cfg.CONF.set_override('scenario_polling_first_timer', 1, group='NWA') - cfg.CONF.set_override('scenario_polling_timer', 2, group='NWA') - cfg.CONF.set_override('scenario_polling_count', 3, group='NWA') - nwa_client = nwa_restclient.NwaRestClient('127.0.0.1', 8080, True) - self.assertEqual(1, nwa_client.workflow_first_wait) - self.assertEqual(2, nwa_client.workflow_wait_sleep) - self.assertEqual(3, nwa_client.workflow_retry_count) - - def test_workflow_kick_and_wait_raise(self): - call_ne = mock.MagicMock( - side_effect=nwa_exc.NwaException(200, 'm1', None)) - call_ne.__name__ = 'POST' - self.assertRaises( - nwa_exc.NwaException, - self.nwa.workflow_kick_and_wait, call_ne, None, None - ) - - @mock.patch('eventlet.semaphore.Semaphore.locked') - @mock.patch('networking_nec.nwa.nwalib.nwa_restclient.NwaRestClient.' - 'workflowinstance') - def test_workflow_kick_and_wait(self, wki, lock): - call = mock.MagicMock() - call.__name__ = 'POST' - call.return_value = 200, None - hst, rd = self.nwa.workflow_kick_and_wait(call, None, None) - self.assertEqual(hst, 200) - self.assertIsNone(rd) - - call.return_value = 200, {'executionid': 1} - wki.return_value = 201, None - hst, rd = self.nwa.workflow_kick_and_wait(call, None, None) - self.assertEqual(hst, 201) - self.assertIsNone(rd) - - call.return_value = 200, {'executionid': '1'} - wki.return_value = 202, None - hst, rd = self.nwa.workflow_kick_and_wait(call, None, None) - self.assertEqual(hst, 202) - self.assertIsNone(rd) - - wki.return_value = 201, {'status': 'RUNNING'} - self.nwa.workflow_retry_count = 1 - hst, rd = self.nwa.workflow_kick_and_wait(call, None, None) - self.assertEqual(hst, 201) - self.assertIsNone(rd) - - wki.side_effect = Exception - hst, rd = self.nwa.workflow_kick_and_wait(call, None, None) - self.assertEqual(hst, 200) - self.assertIsNone(rd) - - @mock.patch('eventlet.semaphore.Semaphore.locked') - @mock.patch('networking_nec.nwa.nwalib.nwa_restclient.NwaRestClient.' - 'workflow_kick_and_wait') - @mock.patch('networking_nec.nwa.nwalib.workflow.NwaWorkflow._nameid', - new_callable=mock.PropertyMock) - def test_call_workflow(self, nameid, wkaw, lock): - call = mock.MagicMock() - call.__name__ = 'POST' - - wkaw.return_value = 200, '0' - nameid.return_value = {'name_0': 'url_0'} - hst, rd = self.nwa.call_workflow('0', call, 'name_0', 'body_0') - self.assertEqual(hst, 200) - self.assertEqual(rd, '0') - - wkaw.return_value = 201, '1' - nameid.return_value = {'name_1': 'url_1'} - hst, rd = self.nwa.call_workflow('1', call, 'name_1', 'body_1') - self.assertEqual(hst, 201) - self.assertEqual(rd, '1') - - def test_get_reserved_dc_resource(self): - self.nwa.get_reserved_dc_resource(TENANT_ID) - - def test_get_tenant_resource(self): - self.nwa.get_tenant_resource(TENANT_ID) - - def test_get_dc_resource_groups(self): - self.nwa.get_dc_resource_groups('OpenStack/DC1/Common/Pod2Grp/Pod2') - - @mock.patch('networking_nec.nwa.nwalib.nwa_restclient.NwaRestClient.get') - def test_get_workflow_list(self, get): - get.return_value = 209, None - hst, rd = self.nwa.get_workflow_list() - self.assertEqual(hst, 209) - self.assertIsNone(rd) - - get.side_effect = Exception - hst, rd = self.nwa.get_workflow_list() - self.assertIsNone(hst) - self.assertIsNone(rd) - - def test_stop_workflowinstance(self): - self.nwa.stop_workflowinstance('id-0') - - def test_update_workflow_list(self): - self.nwa.update_workflow_list() - - def test_wait_workflow_done(self): - self.nwa.wait_workflow_done(mock.MagicMock()) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_restclient.py b/networking_nec/tests/unit/nwa/nwalib/test_restclient.py deleted file mode 100644 index 821d34b..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_restclient.py +++ /dev/null @@ -1,103 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import datetime - -import mock -from neutron.tests import base -import requests - -from networking_nec.nwa.nwalib import exceptions as nwa_exc -from networking_nec.nwa.nwalib import restclient - - -class TestRestClient(base.BaseTestCase): - def setUp(self): - super(TestRestClient, self).setUp() - self.rcl = restclient.RestClient() - - def test__url(self): - rcl = restclient.RestClient('127.0.0.2', 8081, True) - path = '/path' - u = rcl._url(path) - self.assertEqual(u, 'https://127.0.0.2:8081' + path) - - @mock.patch('networking_nec.nwa.nwalib.restclient.utcnow') - @mock.patch('requests.request') - def test__send_receive(self, rr, utcnow): - now_for_test = datetime.datetime(2016, 2, 24, 5, 23) - now_string = 'Wed, 24 Feb 2016 05:23:00 GMT' - utcnow.return_value = now_for_test - myauth = mock.Mock() - myauth.return_value = mock.sentinel.auth_val - rcl = restclient.RestClient('127.0.0.3', 8083, True, myauth) - rcl._send_receive('GET', '/path') - rr.assert_called_once_with( - 'GET', 'https://127.0.0.3:8083/path', - data=None, - headers={'Authorization': mock.sentinel.auth_val, - 'Content-Type': 'application/json', - 'Date': now_string, - 'X-UMF-API-Version': restclient.UMF_API_VERSION}, - verify=False, - proxies={'no': 'pass'}) - myauth.assert_called_once_with(now_string, '/path') - - @mock.patch('requests.request') - def test_rest_api(self, rr): - def myauth(a, b): - pass - - rcl = restclient.RestClient('127.0.0.4', 8084, True, myauth) - body = {} - url = 'http://127.0.0.4:8084/path' - rr.side_effect = requests.exceptions.RequestException - self.assertRaises( - nwa_exc.NwaException, - rcl.rest_api, 'GET', url, body - ) - - @mock.patch('requests.request') - def test_rest_api_raise(self, rr): - def myauth(a, b): - pass - - rr.side_effect = OSError - rcl = restclient.RestClient('127.0.0.3', 8083, True, myauth) - body = {'a': 1} - url = 'http://127.0.0.5:8085/path' - self.assertRaises( - OSError, - rcl.rest_api, 'GET', url, body - ) - - @mock.patch('networking_nec.nwa.nwalib.restclient.RestClient.rest_api') - def test_get(self, rarc): - self.rcl.get('') - self.assertEqual(rarc.call_count, 1) - - @mock.patch('networking_nec.nwa.nwalib.restclient.RestClient.rest_api') - def test_post(self, rarc): - self.rcl.post('') - self.assertEqual(rarc.call_count, 1) - - @mock.patch('networking_nec.nwa.nwalib.restclient.RestClient.rest_api') - def test_put(self, rarc): - self.rcl.put('') - self.assertEqual(rarc.call_count, 1) - - @mock.patch('networking_nec.nwa.nwalib.restclient.RestClient.rest_api') - def test_delete(self, rarc): - self.rcl.delete('') - self.assertEqual(rarc.call_count, 1) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_semaphore.py b/networking_nec/tests/unit/nwa/nwalib/test_semaphore.py deleted file mode 100644 index 402ea6b..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_semaphore.py +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.nwalib import semaphore as nwa_sem - - -class TestThread(base.BaseTestCase): - def test_stop(self): - t1 = nwa_sem.Thread(mock.MagicMock()) - t1.stop() - - def test_wait(self): - t1 = nwa_sem.Thread(mock.MagicMock()) - t1.wait() - - -class TestSemaphore(base.BaseTestCase): - def test_get_tenant_semaphore(self): - sem1 = nwa_sem.Semaphore.get_tenant_semaphore('T1') - sem2 = nwa_sem.Semaphore.get_tenant_semaphore('T1') - self.assertEqual(sem1, sem2) - - sem3 = nwa_sem.Semaphore.get_tenant_semaphore('T2') - self.assertTrue(sem1 != sem3) - - nwa_sem.Semaphore.delete_tenant_semaphore('T1') - sem4 = nwa_sem.Semaphore.get_tenant_semaphore('T1') - self.assertTrue(sem1 != sem4) - - def test_get_tenant_semaphore_raise1(self): - self.assertRaises( - TypeError, - nwa_sem.Semaphore.get_tenant_semaphore, 0 - ) - - def test_get_tenant_semaphore_raise2(self): - self.assertRaises( - TypeError, - nwa_sem.Semaphore.get_tenant_semaphore, '' - ) - - def test_delete_tenant_semaphore(self): - nwa_sem.Semaphore.delete_tenant_semaphore('T11') - self.assertTrue(True) diff --git a/networking_nec/tests/unit/nwa/nwalib/test_workflow.py b/networking_nec/tests/unit/nwa/nwalib/test_workflow.py deleted file mode 100644 index cad68ae..0000000 --- a/networking_nec/tests/unit/nwa/nwalib/test_workflow.py +++ /dev/null @@ -1,86 +0,0 @@ -# Copyright 2015-2016 NEC Corporation. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import mock -from neutron.tests import base - -from networking_nec.nwa.nwalib import workflow - - -class TestNwaWorkflow(base.BaseTestCase): - def test_strerror(self): - em = workflow.NwaWorkflow.strerror('1') - self.assertEqual(em, 'Unknown parent node') - em = workflow.NwaWorkflow.strerror('299') - self.assertEqual(em, 'Unknown error') - - def test_get_errno_from_resultdata(self): - geterrno = workflow.NwaWorkflow.get_errno_from_resultdata - rc = geterrno({}) - self.assertIsNone(rc) - - rc = geterrno({ - 'resultdata': {} - }) - self.assertIsNone(rc) - - rc = geterrno({ - 'resultdata': { - 'ErrorMessage': '' - } - }) - self.assertIsNone(rc) - - rc = geterrno({ - 'resultdata': { - 'ErrorMessage': 'ErrorNumber=100' - } - }) - self.assertEqual(rc, '100') - - rc = geterrno({ - 'resultdata': { - 'ErrorMessage': 'ReservationErrorCode = 101' - } - }) - self.assertEqual(rc, '101') - - def test_update_nameid(self): - with mock.patch('networking_nec.nwa.nwalib.workflow' - '.NwaWorkflow._nameid', - new_callable=mock.PropertyMock) as nameid, \ - mock.patch('networking_nec.nwa.nwalib.workflow' - '.NwaWorkflow._nameid_initialized', - new_callable=mock.PropertyMock): - - # When nameid is initialized, nameid will be unchanged. - workflow.NwaWorkflow._nameid_initialized = True - nameid.return_value = mock.sentinel.nameid - workflow.NwaWorkflow.update_nameid({'foo': '1'}) - self.assertTrue(workflow.NwaWorkflow._nameid_initialized) - self.assertIs(mock.sentinel.nameid, workflow.NwaWorkflow._nameid) - - # If passed nameid is empty, nameid will be unchanged. - workflow.NwaWorkflow._nameid_initialized = False - nameid.return_value = mock.sentinel.nameid - workflow.NwaWorkflow.update_nameid({}) - self.assertFalse(workflow.NwaWorkflow._nameid_initialized) - self.assertIs(mock.sentinel.nameid, workflow.NwaWorkflow._nameid) - - # If nameid is not initialized and passed nameid is not empty, - # nameid will be initialized. - workflow.NwaWorkflow._nameid_initialized = False - workflow.NwaWorkflow.update_nameid({'foo': '1'}) - self.assertTrue(workflow.NwaWorkflow._nameid_initialized) - self.assertDictEqual({'foo': '1'}, workflow.NwaWorkflow._nameid) diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 8d829c7..0000000 --- a/requirements.txt +++ /dev/null @@ -1,27 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -pbr>=1.6 # Apache-2.0 - -Babel>=2.3.4 # BSD -debtcollector>=1.2.0 # Apache-2.0 -eventlet!=0.18.3,>=0.18.2 # MIT -netaddr!=0.7.16,>=0.7.13 # BSD -neutron-lib>=0.4.0 # Apache-2.0 -oslo.config>=3.14.0 # Apache-2.0 -oslo.i18n>=2.1.0 # Apache-2.0 -oslo.log>=1.14.0 # Apache-2.0 -oslo.messaging>=5.2.0 # Apache-2.0 -oslo.serialization>=1.10.0 # Apache-2.0 -oslo.service>=1.10.0 # Apache-2.0 -oslo.utils>=3.16.0 # Apache-2.0 -requests>=2.10.0 # Apache-2.0 -six>=1.9.0 # MIT -SQLAlchemy<1.1.0,>=1.0.10 # MIT -WebOb>=1.2.3 # MIT - -# This project does depend on neutron as a library, but the -# openstack tooling does not play nicely with projects that -# are not publicly available in pypi. -# -e git+https://git.openstack.org/openstack/neutron#egg=neutron diff --git a/rpm/neutron-necnwa-agent.service b/rpm/neutron-necnwa-agent.service deleted file mode 100644 index 063f703..0000000 --- a/rpm/neutron-necnwa-agent.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=OpenStack Neutron NEC NWA Agent -After=syslog.target network.target - -[Service] -Type=simple -User=neutron -ExecStart=/usr/bin/neutron-necnwa-agent --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini --log-file /var/log/neutron/necnwa-agent.log -PrivateTmp=false - -[Install] -WantedBy=multi-user.target diff --git a/rpm/neutron-necnwa-cleanup b/rpm/neutron-necnwa-cleanup deleted file mode 100755 index 3ee106c..0000000 --- a/rpm/neutron-necnwa-cleanup +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash - -debug=true -interval=300 -conf=/etc/neutron/neutron.conf -logfile=/var/log/neutron/necnwa-cleanup.log -keyconf=/etc/keystone/keystone.conf - -while [[ $# > 1 ]] -do - key="$1" - case $key in - --config-file) - conf="$2" - shift - ;; - --log-file) - logfile="$2" - shift - ;; - *) - ;; - esac - shift -done - -exec 6>&1 -exec >> $logfile 2>&1 - -line=$(sed -n -r 's,^\s*connection\s*=\s*mysql://([^:]?+):([^@]?+)@.*,\1 \2,p' $conf) -set -- $line -db_user=$1 -db_password=$2 - -if [ -z "$db_user" ]; then - echo 1>&2 "Error: db_user is not defined" - exit 1 -fi -if [ -z "$db_password" ]; then - echo 1>&2 "Error: db_password is not defined" - exit 1 -fi -db_table=neutron -mysql="mysql -u$db_user -p$db_password $db_table" - -line=$(sed -n -r 's,^\s*connection\s*=\s*mysql://([^:]?+):([^@]?+)@.*,\1 \2,p' $keyconf) -set -- $line -key_user=$1 -key_pass=$2 -list_cmd="mysql -u$key_user -p$key_pass keystone" - -while true -do - date=$(date '+%Y-%m-%d %H:%M:%S.000') - project_list=$($list_cmd -e 'select * from project;' 2>/dev/null | \ - egrep -v -e 'id *name' |awk '{print $1;}') - queue_list=$($mysql -e 'select * from nwa_tenant_queue;' | \ - egrep -v -e '\-\-|tenant_id' | awk '{print $1;}') - for q in $queue_list; do - remove=true - for p in $project_list; do - if [[ $p == $q ]]; then - remove=false - break - fi - done - if $remove; then - op="delete from nwa_tenant_queue where tenant_id = '$q';" - echo "$date $$ INFO $op" >>$logfile 2>&1 - $mysql -e "$op" - fi - done - sleep $interval -done -# echo "Now, execute the following command:" -# echo " $ sudo systemctl restart neutron-server neutron-necnwa-agent" diff --git a/rpm/neutron-necnwa-cleanup.service b/rpm/neutron-necnwa-cleanup.service deleted file mode 100644 index c011b0e..0000000 --- a/rpm/neutron-necnwa-cleanup.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=OpenStack Neutron NECNWA Agent Cleanup Queue -After=syslog.target network.target - -[Service] -Type=simple -User=neutron -ExecStart=/usr/bin/neutron-necnwa-cleanup --config-file /etc/neutron/neutron.conf --log-file /var/log/neutron/necnwa-cleanup.log -PrivateTmp=false - -[Install] -WantedBy=multi-user.target diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b246926..0000000 --- a/setup.cfg +++ /dev/null @@ -1,66 +0,0 @@ -[metadata] -name = networking-nec -summary = Neutron plugins/drivers for NEC networking products -description-file = - README.rst -author = OpenStack -author-email = openstack-dev@lists.openstack.org -home-page = http://www.openstack.org/ -classifier = - Environment :: OpenStack - Intended Audience :: Information Technology - Intended Audience :: System Administrators - License :: OSI Approved :: Apache Software License - Operating System :: POSIX :: Linux - Programming Language :: Python - Programming Language :: Python :: 2 - Programming Language :: Python :: 2.7 - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.4 - -[files] -packages = - networking_nec -data_files = - etc/ = etc/* - -[entry_points] -console_scripts = - neutron-necnwa-agent = networking_nec.cmd.eventlet.nwa_agent:main -neutron.core_plugins = - necnwa = networking_nec.nwa.l2.plugin:NECNWAL2Plugin -neutron.service_plugins = - necnwa_router = networking_nec.nwa.l3.plugin:NECNWAL3Plugin -neutron.ml2.mechanism_drivers = - necnwa = networking_nec.nwa.l2.drivers.mech_necnwa:NECNWAMechanismDriver -neutron.db.alembic_migrations = - networking-nec = networking_nec.db.migration:alembic_migrations - -[global] -setup-hooks = - pbr.hooks.setup_hook - -[build_sphinx] -source-dir = doc/source -build-dir = doc/build -all_files = 1 - -[upload_sphinx] -upload-dir = doc/build/html - -[compile_catalog] -directory = networking_nec/locale -domain = networking_nec - -[update_catalog] -domain = networking_nec -output_dir = networking_nec/locale -input_file = networking_nec/locale/networking_nec.pot - -[extract_messages] -keywords = _ gettext ngettext l_ lazy_gettext -mapping_file = babel.cfg -output_file = networking_nec/locale/networking_nec.pot - -[wheel] -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index 782bb21..0000000 --- a/setup.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT -import setuptools - -# In python < 2.7.4, a lazy loading of package `pbr` will break -# setuptools if some other modules registered functions in `atexit`. -# solution from: http://bugs.python.org/issue15881#msg170215 -try: - import multiprocessing # noqa -except ImportError: - pass - -setuptools.setup( - setup_requires=['pbr>=1.8'], - pbr=True) diff --git a/test-requirements.txt b/test-requirements.txt deleted file mode 100644 index 45282c5..0000000 --- a/test-requirements.txt +++ /dev/null @@ -1,22 +0,0 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - -hacking<0.11,>=0.10.0 - -astroid<1.4.0 # LGPLv2.1 # breaks pylint 1.4.4 -coverage>=3.6 # Apache-2.0 -fixtures>=3.0.0 # Apache-2.0/BSD -mock>=2.0 # BSD -pylint==1.4.5 # GPLv2 -python-subunit>=0.0.18 # Apache-2.0/BSD -requests-mock>=1.0 # Apache-2.0 -sphinx!=1.3b1,<1.3,>=1.2.1 # BSD -oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0 -oslotest>=1.10.0 # Apache-2.0 -tempest-lib>=0.14.0 # Apache-2.0 -testrepository>=0.0.18 # Apache-2.0/BSD -testresources>=0.2.4 # Apache-2.0/BSD -testscenarios>=0.4 # Apache-2.0/BSD -testtools>=1.4.0 # MIT -WebTest>=2.0 # MIT diff --git a/tools/coding-checks.sh b/tools/coding-checks.sh deleted file mode 100644 index 550658a..0000000 --- a/tools/coding-checks.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -set -eu - -usage () { - echo "Usage: $0 [OPTION]..." - echo "Run Neutron's coding check(s)" - echo "" - echo " -Y, --pylint [] Run pylint check on the entire networking_nec module or just files changed in basecommit (e.g. HEAD~1)" - echo " -h, --help Print this usage message" - echo - exit 0 -} - -process_options () { - i=1 - while [ $i -le $# ]; do - eval opt=\$$i - case $opt in - -h|--help) usage;; - -Y|--pylint) pylint=1;; - *) scriptargs="$scriptargs $opt" - esac - i=$((i+1)) - done -} - -run_pylint () { - local target="${scriptargs:-all}" - - if [ "$target" = "all" ]; then - files="networking_nec" - else - case "$target" in - *HEAD~[0-9]*) files=$(git diff --diff-filter=AM --name-only $target -- "*.py");; - *) echo "$target is an unrecognized basecommit"; exit 1;; - esac - fi - - echo "Running pylint..." - echo "You can speed this up by running it on 'HEAD~[0-9]' (e.g. HEAD~1, this change only)..." - if [ -n "${files}" ]; then - pylint --rcfile=.pylintrc --output-format=colorized ${files} - else - echo "No python changes in this commit, pylint check not required." - exit 0 - fi -} - -scriptargs= -pylint=1 - -process_options $@ - -if [ $pylint -eq 1 ]; then - run_pylint - exit 0 -fi diff --git a/tools/pretty_tox.sh b/tools/pretty_tox.sh deleted file mode 100755 index 61d5bfd..0000000 --- a/tools/pretty_tox.sh +++ /dev/null @@ -1,13 +0,0 @@ -#! /bin/sh - -TESTRARGS=$1 - -# Delete bytecodes from normal directories before running tests. -# Note that bytecodes in dot directories will not be deleted -# to keep bytecodes of python modules installed into virtualenvs. -sh -c "find . -type d -name '.?*' -prune -o \ - \( -type d -name '__pycache__' -o -type f -name '*.py[co]' \) \ - -print0 | xargs -0 rm -rf" - -exec 3>&1 -status=$(exec 4>&1 >&3; ( python setup.py testr --slowest --testr-args="--subunit $TESTRARGS"; echo $? >&4 ) | subunit-trace -f) && exit $status diff --git a/tools/tox_install.sh b/tools/tox_install.sh deleted file mode 100755 index e40f212..0000000 --- a/tools/tox_install.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Many of neutron's repos suffer from the problem of depending on neutron, -# but it not existing on pypi. - -# This wrapper for tox's package installer will use the existing package -# if it exists, else use zuul-cloner if that program exists, else grab it -# from neutron master via a hard-coded URL. That last case should only -# happen with devs running unit tests locally. - -# From the tox.ini config page: -# install_command=ARGV -# default: -# pip install {opts} {packages} - -ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner -neutron_installed=$(echo "import neutron" | python 2>/dev/null ; echo $?) -# Neutron branch to be used -BRANCH_NAME=master - -set -e - -CONSTRAINTS_FILE=$1 -shift - -install_cmd="pip install" -if [ $CONSTRAINTS_FILE != "unconstrained" ]; then - install_cmd="$install_cmd -c$CONSTRAINTS_FILE" -fi - -if [ $neutron_installed -eq 0 ]; then - echo "ALREADY INSTALLED" > /tmp/tox_install.txt - echo "Neutron already installed; using existing package" -elif [ -x "$ZUUL_CLONER" ]; then - echo "ZUUL CLONER" > /tmp/tox_install.txt - cwd=$(/bin/pwd) - cd /tmp - $ZUUL_CLONER --cache-dir \ - /opt/git \ - --branch $BRANCH_NAME \ - git://git.openstack.org \ - openstack/neutron - cd openstack/neutron - $install_cmd -e . - cd "$cwd" -else - echo "PIP HARDCODE" > /tmp/tox_install.txt - $install_cmd -U -egit+https://git.openstack.org/openstack/neutron.git@$BRANCH_NAME#egg=neutron -fi - -$install_cmd -U $* -exit $? diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 153399a..0000000 --- a/tox.ini +++ /dev/null @@ -1,52 +0,0 @@ -[tox] -minversion = 1.6 -envlist = py34,py27,pep8 -skipsdist = True - -[testenv] -usedevelop = True -install_command = - # networking-nec is still targetted to Mitaka development, - # so we need to use upper-constraints.txt from stable/mitaka branch. - {toxinidir}/tools/tox_install.sh {env:UPPER_CONSTRAINTS_FILE:https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=master} {opts} {packages} -# Note the hash seed is set to 0 until neutron can be tested with a -# random hash seed successfully. -setenv = - VIRTUAL_ENV={envdir} - PYTHONWARNINGS=default::DeprecationWarning -deps = -r{toxinidir}/test-requirements.txt -whitelist_externals = sh -commands = - sh tools/pretty_tox.sh '{posargs}' -# there is also secret magic in pretty_tox.sh which lets you run in a fail only -# mode. To do this define the TRACE_FAILONLY environmental variable. - -[testenv:pep8] -deps = - {[testenv]deps} -commands = - flake8 - sh ./tools/coding-checks.sh --pylint '{posargs}' - neutron-db-manage --subproject networking-nec --database-connection sqlite:// check_migration - -[testenv:venv] -commands = {posargs} - -[testenv:cover] -commands = python setup.py test --coverage --coverage-package-name=networking_nec --testr-args='{posargs}' - -[testenv:docs] -commands = sphinx-build -W -b html doc/source doc/build/html - -[testenv:debug] -commands = oslo_debug_helper {posargs} - -[flake8] -# TODO(dougwig) -- uncomment this to test for remaining linkages -# N530 direct neutron imports not allowed -ignore = N530 -exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build - -[hacking] -import_exceptions = networking_nec._i18n -local-check-factory = neutron_lib.hacking.checks.factory