Search in sources :

Example 6 with NeutronPortWrapper

use of org.apache.cloudstack.network.opendaylight.api.model.NeutronPortWrapper in project cloudstack by apache.

the class NeutronPortAdapterTest method gsonNeutronPortUnmarshalingTest.

@Test
public <T> void gsonNeutronPortUnmarshalingTest() throws NeutronRestApiException {
    NeutronPort port = new NeutronPort();
    port.setId(UUID.fromString("ca31aa7f-84c7-416d-bc00-1f84927367e0"));
    port.setName("test_gre");
    port.setAdminStateUp(true);
    port.setDeviceId(UUID.fromString("ca31aa7f-84c7-416d-bc00-1f84927367e0"));
    port.setMacAddress("ca31aa7f-84c7-416d-bc00-1f84927367e0");
    port.setNetworkId(UUID.fromString("ca31aa7f-84c7-416d-bc00-1f84927367e0"));
    port.setStatus("ACTIVE");
    port.setTenantId("wilder");
    NeutronPortWrapper portWrapper = new NeutronPortWrapper();
    portWrapper.setPort(port);
    NeutronPortWrapper returnValue = (NeutronPortWrapper) gsonNeutronPort.fromJson(jsonString, TypeToken.get(portWrapper.getClass()).getType());
    Assert.assertNotNull(returnValue);
    Assert.assertEquals("ca31aa7f-84c7-416d-bc00-1f84927367e0", returnValue.getPort().getMacAddress());
}
Also used : NeutronPort(org.apache.cloudstack.network.opendaylight.api.model.NeutronPort) NeutronPortWrapper(org.apache.cloudstack.network.opendaylight.api.model.NeutronPortWrapper) Test(org.junit.Test)

Aggregations

NeutronPortWrapper (org.apache.cloudstack.network.opendaylight.api.model.NeutronPortWrapper)6 NeutronPort (org.apache.cloudstack.network.opendaylight.api.model.NeutronPort)3 Test (org.junit.Test)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 NeutronRestApiException (org.apache.cloudstack.network.opendaylight.api.NeutronRestApiException)2 NeutronPortsNorthboundAction (org.apache.cloudstack.network.opendaylight.api.resources.NeutronPortsNorthboundAction)2 StringRequestEntity (org.apache.commons.httpclient.methods.StringRequestEntity)2 Type (java.lang.reflect.Type)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 ConfigurePortAnswer (org.apache.cloudstack.network.opendaylight.agent.responses.ConfigurePortAnswer)1