@@ -0,0 +1,2734 @@
+# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A#      http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# Unless required by applicable law or agreed to in writing, software%0A# distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT%0A# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the%0A# License for the specific language governing permissions and limitations%0A# under the License.%0A%0Aimport uuid%0A%0Afrom openstack.network.v2 import network%0Afrom openstack.network.v2 import router%0Afrom openstack.network.v2 import subnet%0Afrom openstack.tests.functional import base%0A%0A%0Aclass TestRouterInterface(base.BaseFunctionalTest):%0A%0A    ROUTER_NAME = uuid.uuid4().hex%0A    NET_NAME = uuid.uuid4().hex%0A    SUB_NAME = uuid.uuid4().hex%0A    CIDR = %2210.100.0.0/16%22%0A    IPV4 = 4%0A    ROUTER_ID = None%0A    NET_ID = None%0A    SUB_ID = None%0A    ROT = None%0A%0A    @classmethod%0A    def setUpClass(cls):%0A        super(TestRouterInterface, cls).setUpClass()%0A        sot = cls.conn.network.create_router(name=cls.ROUTER_NAME)%0A        assert isinstance(sot, router.Router)%0A        cls.assertIs(cls.ROUTER_NAME, sot.name)%0A        net = cls.conn.network.create_network(name=cls.NET_NAME)%0A        assert isinstance(net, network.Network)%0A        cls.assertIs(cls.NET_NAME, net.name)%0A        sub = cls.conn.network.create_subnet(name=cls.SUB_NAME,%0A                                             ip_version=cls.IPV4,%0A                                             network_id=net.id,%0A                                             cidr=cls.CIDR)%0A        assert isinstance(sub, subnet.Subnet)%0A        cls.assertIs(cls.SUB_NAME, sub.name)%0A        cls.ROUTER_ID = sot.id%0A        cls.ROT = sot%0A        cls.NET_ID = net.id%0A        cls.SUB_ID = sub.id%0A%0A    @classmethod%0A    def tearDownClass(cls):%0A        sot = cls.conn.network.delete_router(cls.ROUTER_ID,%0A                                             ignore_missing=False)%0A        cls.assertIs(None, sot)%0A        sot = cls.conn.network.delete_subnet(cls.SUB_ID, ignore_missing=False)%0A        cls.assertIs(None, sot)%0A        sot = cls.conn.network.delete_network(cls.NET_ID, ignore_missing=False)%0A        cls.assertIs(None, sot)%0A%0A    def test_router_add_interface(self):%0A        iface = self.ROT.add_interface(self.conn.session, self.SUB_ID)%0A        self._verification(iface)%0A%0A    def test_router_remove_interface(self):%0A        iface = self.ROT.remove_interface(self.conn.session, self.SUB_ID)%0A        self._verification(iface)%0A%0A    def _verification(self, interface):%0A        self.assertEqual(interface%5B'subnet_id'%5D, self.SUB_ID)%0A        self.assertIn('port_id', interface)%0A

Add functional tests for add & remove router interface