@Test
    public void testCreateWhenAlreadyBound() {
      DtoHost host = hostTopology.getHost(host1Id);
      DtoBridgePort port1 = topology.getBridgePort("bridgePort1");

      bindHostToTunnelZone(host1Id);

      // List mappings.  There should be none.
      DtoHostInterfacePort[] maps =
          dtoResource.getAndVerifyOk(
              host.getPorts(),
              APPLICATION_HOST_INTERFACE_PORT_COLLECTION_JSON(),
              DtoHostInterfacePort[].class);
      Assert.assertEquals(0, maps.length);

      DtoHostInterfacePort mapping = new DtoHostInterfacePort();
      mapping.setPortId(port1.getId());
      mapping.setInterfaceName("eth0");
      dtoResource.postAndVerifyCreated(
          host.getPorts(),
          APPLICATION_HOST_INTERFACE_PORT_JSON(),
          mapping,
          DtoHostInterfacePort.class);

      mapping = new DtoHostInterfacePort();
      mapping.setPortId(port1.getId());
      mapping.setInterfaceName("eth1");
      dtoResource.postAndVerifyBadRequest(
          host.getPorts(), APPLICATION_HOST_INTERFACE_PORT_JSON(), mapping);
    }
    @Test
    public void testCreateWhenHostIsNotInAnyTunnelZone() {
      DtoHost host = hostTopology.getHost(host1Id);
      DtoBridgePort port = topology.getBridgePort("bridgePort1");

      // Map a tunnel zone to a host
      DtoHostInterfacePort mapping = new DtoHostInterfacePort();
      mapping.setPortId(port.getId());
      mapping.setInterfaceName("eth0");
      DtoError error =
          dtoResource.postAndVerifyBadRequest(
              host.getPorts(), APPLICATION_HOST_INTERFACE_PORT_JSON(), mapping);
      assertErrorMatchesLiteral(error, getMessage(HOST_IS_NOT_IN_ANY_TUNNEL_ZONE, host1Id));
    }