Search in sources :

Example 1 with NeutronRouterInterface

use of org.openstack4j.openstack.networking.domain.NeutronRouterInterface in project camel by apache.

the class RouterProducerTest method detachTest.

@Test
public void detachTest() throws Exception {
    final String routerID = "myRouterID";
    final String portId = "port";
    final String subnetId = "subnet";
    final RouterInterface ifce = new NeutronRouterInterface(subnetId, portId);
    when(routerService.detachInterface(anyString(), anyString(), anyString())).thenReturn(ifce);
    msg.setHeader(OpenstackConstants.OPERATION, NeutronConstants.DETACH_INTERFACE);
    msg.setHeader(NeutronConstants.ROUTER_ID, routerID);
    msg.setHeader(NeutronConstants.SUBNET_ID, subnetId);
    msg.setHeader(NeutronConstants.PORT_ID, portId);
    producer.process(exchange);
    ArgumentCaptor<String> routerC = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<String> portC = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<String> subnetC = ArgumentCaptor.forClass(String.class);
    verify(routerService).detachInterface(routerC.capture(), subnetC.capture(), portC.capture());
    assertEquals(routerID, routerC.getValue());
    assertEquals(subnetId, subnetC.getValue());
    assertEquals(portId, portC.getValue());
    assertEquals(ifce, msg.getBody(RouterInterface.class));
}
Also used : RouterInterface(org.openstack4j.model.network.RouterInterface) NeutronRouterInterface(org.openstack4j.openstack.networking.domain.NeutronRouterInterface) Matchers.anyString(org.mockito.Matchers.anyString) NeutronRouterInterface(org.openstack4j.openstack.networking.domain.NeutronRouterInterface) Test(org.junit.Test)

Example 2 with NeutronRouterInterface

use of org.openstack4j.openstack.networking.domain.NeutronRouterInterface in project camel by apache.

the class RouterProducerTest method attachTest.

@Test
public void attachTest() throws Exception {
    final String routerID = "myRouterID";
    final String subnetId = "subnet";
    final RouterInterface ifce = new NeutronRouterInterface(subnetId, null);
    when(routerService.attachInterface(anyString(), any(AttachInterfaceType.class), anyString())).thenReturn(ifce);
    msg.setHeader(OpenstackConstants.OPERATION, NeutronConstants.ATTACH_INTERFACE);
    msg.setHeader(NeutronConstants.ROUTER_ID, routerID);
    msg.setHeader(NeutronConstants.SUBNET_ID, subnetId);
    msg.setHeader(NeutronConstants.ITERFACE_TYPE, AttachInterfaceType.SUBNET);
    producer.process(exchange);
    ArgumentCaptor<String> routerC = ArgumentCaptor.forClass(String.class);
    ArgumentCaptor<AttachInterfaceType> itfType = ArgumentCaptor.forClass(AttachInterfaceType.class);
    ArgumentCaptor<String> subnetC = ArgumentCaptor.forClass(String.class);
    verify(routerService).attachInterface(routerC.capture(), itfType.capture(), subnetC.capture());
    assertEquals(routerID, routerC.getValue());
    assertEquals(AttachInterfaceType.SUBNET, itfType.getValue());
    assertEquals(subnetId, subnetC.getValue());
    assertEquals(ifce, msg.getBody(RouterInterface.class));
}
Also used : RouterInterface(org.openstack4j.model.network.RouterInterface) NeutronRouterInterface(org.openstack4j.openstack.networking.domain.NeutronRouterInterface) Matchers.anyString(org.mockito.Matchers.anyString) NeutronRouterInterface(org.openstack4j.openstack.networking.domain.NeutronRouterInterface) AttachInterfaceType(org.openstack4j.model.network.AttachInterfaceType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 Matchers.anyString (org.mockito.Matchers.anyString)2 RouterInterface (org.openstack4j.model.network.RouterInterface)2 NeutronRouterInterface (org.openstack4j.openstack.networking.domain.NeutronRouterInterface)2 AttachInterfaceType (org.openstack4j.model.network.AttachInterfaceType)1