Пример #1
0
 /**
  * Services provide this interface method to indicate if the specified interface can be attached
  * to the specified route
  *
  * @param router instance of the base Neutron Router object
  * @param routerInterface instance of the NeutronRouter_Interface to be attached to the router
  * @return integer the return value is understood to be a HTTP status code. A return value outside
  *     of 200 through 299 results in the attach operation being interrupted and the returned
  *     status value reflected in the HTTP response.
  */
 @Override
 public int canAttachInterface(NeutronRouter router, NeutronRouter_Interface routerInterface) {
   logger.debug(
       " Router {} asked if it can attach interface {}. Subnet {}",
       router.getName(),
       routerInterface.getPortUUID(),
       routerInterface.getSubnetUUID());
   return HttpURLConnection.HTTP_OK;
 }
Пример #2
0
  @Test
  public void testCanAttachAndDettachInterface() {
    NeutronRouter router = mock(NeutronRouter.class);
    when(router.getName()).thenReturn("router_name");

    NeutronRouter_Interface routerInterface = mock(NeutronRouter_Interface.class);
    when(routerInterface.getPortUUID()).thenReturn("portUUID");
    when(routerInterface.getSubnetUUID()).thenReturn("subnetUUID");

    assertEquals(
        "Error, canAttachInterface() did not return the correct HTTP flag",
        HttpURLConnection.HTTP_OK,
        routerHandler.canAttachInterface(router, routerInterface));
    assertEquals(
        "Error, canDetachInterface() did not return the correct HTTP flag",
        HttpURLConnection.HTTP_OK,
        routerHandler.canDetachInterface(router, routerInterface));
  }