'Test access to the l3-agent metadata proxy.
The test creates:
* A l3-agent metadata service:
* A router (which creates a metadata proxy in the router namespace),
* A fake metadata server
* A "client" namespace (simulating a vm) with a port on router
internal subnet.
The test queries from the "client" namespace the metadata proxy on
http://169.254.169.254 and asserts that the metadata proxy added
the X-Forwarded-For and X-Neutron-Router-Id headers to the request
and forwarded the http request to the fake metadata server and the
response to the "client" namespace.'

def test_access_to_metadata_proxy(self):

    router_info = self.generate_router_info(enable_ha=False)
    router = self.manage_router(self.agent, router_info)
    self._create_metadata_fake_server(webob.exc.HTTPOk.code)
    router_ip_cidr = self._port_first_ip_cidr(router.internal_ports[0])
    br_int = framework.get_ovs_bridge(self.agent.conf.ovs_integration_bridge)
    machine = self.useFixture(machine_fixtures.FakeMachine(br_int, net_helpers.increment_ip_cidr(router_ip_cidr), router_ip_cidr.partition('/')[0]))
    firstline = self._query_metadata_proxy(machine)
    self.assertIn(str(webob.exc.HTTPOk.code), firstline.split())
