Search in sources :

Example 6 with CodecService

use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.

the class K8sNodeCodecRegisterTest method testActivateDeactivate.

/**
 * Tests codec register activation and deactivation.
 */
@Test
public void testActivateDeactivate() {
    register = new K8sNodeCodecRegister();
    CodecService codecService = new TestCodecService();
    TestUtils.setField(register, "codecService", codecService);
    register.activate();
    assertEquals(K8sNodeCodec.class.getName(), codecService.getCodec(K8sNode.class).getClass().getName());
    register.deactivate();
    assertNull(codecService.getCodec(K8sNode.class));
}
Also used : K8sNode(org.onosproject.k8snode.api.K8sNode) CodecService(org.onosproject.codec.CodecService) K8sNodeCodec(org.onosproject.k8snode.codec.K8sNodeCodec) Test(org.junit.Test)

Example 7 with CodecService

use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.

the class KubevirtNetworkingCodecRegisterTest method testActivateDeactivate.

/**
 * Tests codec register activation and deactivation.
 */
@Test
public void testActivateDeactivate() {
    KubevirtNetworkingCodecRegister register = new KubevirtNetworkingCodecRegister();
    CodecService codecService = new TestCodecService();
    TestUtils.setField(register, "codecService", codecService);
    register.activate();
    assertEquals(KubevirtNetworkCodec.class.getName(), codecService.getCodec(KubevirtNetwork.class).getClass().getName());
    assertEquals(KubevirtHostRouteCodec.class.getName(), codecService.getCodec(KubevirtHostRoute.class).getClass().getName());
    assertEquals(KubevirtIpPoolCodec.class.getName(), codecService.getCodec(KubevirtIpPool.class).getClass().getName());
    register.deactivate();
}
Also used : KubevirtNetworkCodec(org.onosproject.kubevirtnetworking.codec.KubevirtNetworkCodec) KubevirtNetwork(org.onosproject.kubevirtnetworking.api.KubevirtNetwork) CodecService(org.onosproject.codec.CodecService) KubevirtHostRoute(org.onosproject.kubevirtnetworking.api.KubevirtHostRoute) KubevirtIpPool(org.onosproject.kubevirtnetworking.api.KubevirtIpPool) KubevirtIpPoolCodec(org.onosproject.kubevirtnetworking.codec.KubevirtIpPoolCodec) KubevirtHostRouteCodec(org.onosproject.kubevirtnetworking.codec.KubevirtHostRouteCodec) Test(org.junit.Test)

Example 8 with CodecService

use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.

the class KubevirtNodeCodecRegisterTest method testActivateDeactivate.

/**
 * Tests codec register activation and deactivation.
 */
@Test
public void testActivateDeactivate() {
    register = new KubevirtNodeCodecRegister();
    CodecService codecService = new TestCodecService();
    TestUtils.setField(register, "codecService", codecService);
    register.activate();
    assertEquals(KubevirtNodeCodec.class.getName(), codecService.getCodec(KubevirtNode.class).getClass().getName());
    assertEquals(KubevirtPhyInterfaceCodec.class.getName(), codecService.getCodec(KubevirtPhyInterface.class).getClass().getName());
    register.deactivate();
    assertNull(codecService.getCodec(KubevirtNode.class));
    assertNull(codecService.getCodec(KubevirtPhyInterface.class));
}
Also used : KubevirtNode(org.onosproject.kubevirtnode.api.KubevirtNode) KubevirtNodeCodec(org.onosproject.kubevirtnode.codec.KubevirtNodeCodec) KubevirtPhyInterfaceCodec(org.onosproject.kubevirtnode.codec.KubevirtPhyInterfaceCodec) CodecService(org.onosproject.codec.CodecService) KubevirtPhyInterface(org.onosproject.kubevirtnode.api.KubevirtPhyInterface) Test(org.junit.Test)

Example 9 with CodecService

use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.

the class OpenstackNetworkingCodecRegisterTest method testActivateDeactivate.

/**
 * Tests codec register activation and deactivation.
 */
@Test
public void testActivateDeactivate() {
    register = new OpenstackNetworkingCodecRegister();
    CodecService codecService = new TestCodecService();
    TestUtils.setField(register, "codecService", codecService);
    register.activate();
    assertEquals(InstancePortCodec.class.getName(), codecService.getCodec(InstancePort.class).getClass().getName());
    register.deactivate();
    assertNull(codecService.getCodec(InstancePort.class));
}
Also used : InstancePortCodec(org.onosproject.openstacknetworking.codec.InstancePortCodec) CodecService(org.onosproject.codec.CodecService) InstancePort(org.onosproject.openstacknetworking.api.InstancePort) Test(org.junit.Test)

Example 10 with CodecService

use of org.onosproject.codec.CodecService in project onos by opennetworkinglab.

the class OpenstackRestCodecRegisterTest method testActivateDeactivate.

/**
 * Tests codec register activation and deactivation.
 */
@Test
public void testActivateDeactivate() {
    register = new OpenstackRestCodecRegister();
    CodecService codecService = new TestCodecService();
    TestUtils.setField(register, "codecService", codecService);
    register.activate();
    assertEquals(StatsInfoJsonCodec.class.getName(), codecService.getCodec(StatsInfo.class).getClass().getName());
    assertEquals(FlowInfoJsonCodec.class.getName(), codecService.getCodec(FlowInfo.class).getClass().getName());
    assertEquals(StatsFlowRuleJsonCodec.class.getName(), codecService.getCodec(StatsFlowRule.class).getClass().getName());
    assertEquals(TelemetryConfigJsonCodec.class.getName(), codecService.getCodec(TelemetryConfig.class).getClass().getName());
    register.deactivate();
    assertNull(codecService.getCodec(StatsInfo.class));
    assertNull(codecService.getCodec(FlowInfo.class));
    assertNull(codecService.getCodec(StatsFlowRule.class));
    assertNull(codecService.getCodec(TelemetryConfig.class));
}
Also used : FlowInfo(org.onosproject.openstacktelemetry.api.FlowInfo) StatsFlowRule(org.onosproject.openstacktelemetry.api.StatsFlowRule) StatsInfo(org.onosproject.openstacktelemetry.api.StatsInfo) CodecService(org.onosproject.codec.CodecService) TelemetryConfigJsonCodec(org.onosproject.openstacktelemetry.codec.rest.TelemetryConfigJsonCodec) StatsInfoJsonCodec(org.onosproject.openstacktelemetry.codec.rest.StatsInfoJsonCodec) StatsFlowRuleJsonCodec(org.onosproject.openstacktelemetry.codec.rest.StatsFlowRuleJsonCodec) FlowInfoJsonCodec(org.onosproject.openstacktelemetry.codec.rest.FlowInfoJsonCodec) TelemetryConfig(org.onosproject.openstacktelemetry.api.config.TelemetryConfig) Test(org.junit.Test)

Aggregations

CodecService (org.onosproject.codec.CodecService)13 Test (org.junit.Test)8 Before (org.junit.Before)5 ServiceDirectory (org.onlab.osgi.ServiceDirectory)5 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)5 CodecManager (org.onosproject.codec.impl.CodecManager)5 K8sNode (org.onosproject.k8snode.api.K8sNode)2 K8sNetwork (org.onosproject.k8snetworking.api.K8sNetwork)1 K8sPort (org.onosproject.k8snetworking.api.K8sPort)1 K8sNetworkCodec (org.onosproject.k8snetworking.codec.K8sNetworkCodec)1 K8sPortCodec (org.onosproject.k8snetworking.codec.K8sPortCodec)1 K8sNodeCodec (org.onosproject.k8snode.codec.K8sNodeCodec)1 KubevirtHostRoute (org.onosproject.kubevirtnetworking.api.KubevirtHostRoute)1 KubevirtIpPool (org.onosproject.kubevirtnetworking.api.KubevirtIpPool)1 KubevirtNetwork (org.onosproject.kubevirtnetworking.api.KubevirtNetwork)1 KubevirtHostRouteCodec (org.onosproject.kubevirtnetworking.codec.KubevirtHostRouteCodec)1 KubevirtIpPoolCodec (org.onosproject.kubevirtnetworking.codec.KubevirtIpPoolCodec)1 KubevirtNetworkCodec (org.onosproject.kubevirtnetworking.codec.KubevirtNetworkCodec)1 KubevirtNode (org.onosproject.kubevirtnode.api.KubevirtNode)1 KubevirtPhyInterface (org.onosproject.kubevirtnode.api.KubevirtPhyInterface)1