Search in sources :

Example 26 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class MappingInstructionCodecTest method setUp.

/**
 * Sets up for each test.
 * Creates a context and fetches the mapping instruction codec.
 */
@Before
public void setUp() {
    CodecManager manager = new CodecManager();
    registrator = new MappingCodecRegistrator();
    registrator.codecService = manager;
    registrator.activate();
    context = new MappingCodecContextAdapter(registrator.codecService);
    instructionCodec = context.codec(MappingInstruction.class);
    assertThat(instructionCodec, notNullValue());
}
Also used : MappingCodecRegistrator(org.onosproject.mapping.MappingCodecRegistrator) CodecManager(org.onosproject.codec.impl.CodecManager) MulticastMappingInstruction(org.onosproject.mapping.instructions.MulticastMappingInstruction) MappingInstruction(org.onosproject.mapping.instructions.MappingInstruction) UnicastMappingInstruction(org.onosproject.mapping.instructions.UnicastMappingInstruction) Before(org.junit.Before)

Example 27 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class MappingKeyCodecTest method setUp.

/**
 * Sets up for each test.
 * Creates a context and fetches the mapping key codec.
 */
@Before
public void setUp() {
    CodecManager manager = new CodecManager();
    registrator = new MappingCodecRegistrator();
    registrator.codecService = manager;
    registrator.activate();
    context = new MappingCodecContextAdapter(registrator.codecService);
    keyCodec = context.codec(MappingKey.class);
    assertThat(keyCodec, notNullValue());
}
Also used : MappingCodecRegistrator(org.onosproject.mapping.MappingCodecRegistrator) CodecManager(org.onosproject.codec.impl.CodecManager) MappingKey(org.onosproject.mapping.MappingKey) DefaultMappingKey(org.onosproject.mapping.DefaultMappingKey) Before(org.junit.Before)

Example 28 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class MappingValueCodecTest method setUp.

/**
 * Sets up for each test.
 * Creates a context and fetches the mapping value codec.
 */
@Before
public void setUp() {
    CodecManager manager = new CodecManager();
    registrator = new MappingCodecRegistrator();
    registrator.codecService = manager;
    registrator.activate();
    context = new MappingCodecContextAdapter(registrator.codecService);
    valueCodec = context.codec(MappingValue.class);
    assertThat(valueCodec, notNullValue());
}
Also used : MappingCodecRegistrator(org.onosproject.mapping.MappingCodecRegistrator) CodecManager(org.onosproject.codec.impl.CodecManager) DefaultMappingValue(org.onosproject.mapping.DefaultMappingValue) MappingValue(org.onosproject.mapping.MappingValue) Before(org.junit.Before)

Example 29 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class KubevirtNetworkWebResourceTest method setUpTest.

/**
 * Sets up the global values for all the tests.
 */
@Before
public void setUpTest() {
    final CodecManager codecService = new CodecManager();
    codecService.activate();
    codecService.registerCodec(KubevirtHostRoute.class, new KubevirtHostRouteCodec());
    codecService.registerCodec(KubevirtIpPool.class, new KubevirtIpPoolCodec());
    codecService.registerCodec(KubevirtNetwork.class, new KubevirtNetworkCodec());
    ServiceDirectory testDirectory = new TestServiceDirectory().add(KubevirtNetworkAdminService.class, mockAdminService).add(CodecService.class, codecService);
    setServiceDirectory(testDirectory);
    network = DefaultKubevirtNetwork.builder().networkId("network").name("network").type(KubevirtNetwork.Type.FLAT).cidr("10.10.10.0/24").mtu(1500).gatewayIp(IpAddress.valueOf("10.10.10.1")).defaultRoute(true).ipPool(new KubevirtIpPool(IpAddress.valueOf("10.10.10.100"), IpAddress.valueOf("10.10.10.200"))).build();
}
Also used : KubevirtNetworkCodec(org.onosproject.kubevirtnetworking.codec.KubevirtNetworkCodec) ServiceDirectory(org.onlab.osgi.ServiceDirectory) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) KubevirtNetworkAdminService(org.onosproject.kubevirtnetworking.api.KubevirtNetworkAdminService) TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) KubevirtIpPool(org.onosproject.kubevirtnetworking.api.KubevirtIpPool) KubevirtIpPoolCodec(org.onosproject.kubevirtnetworking.codec.KubevirtIpPoolCodec) KubevirtHostRouteCodec(org.onosproject.kubevirtnetworking.codec.KubevirtHostRouteCodec) Before(org.junit.Before)

Example 30 with CodecManager

use of org.onosproject.codec.impl.CodecManager in project onos by opennetworkinglab.

the class DeviceAnnotationConfigTest method setUpClass.

// TODO consolidate code-clone in ProtectionConfigTest, and define constants for field name
@BeforeClass
public static void setUpClass() throws TestUtilsException {
    directory = new TestServiceDirectory();
    CodecManager codecService = new CodecManager();
    codecService.activate();
    directory.add(CodecService.class, codecService);
    // replace service directory used by BaseConfig
    original = TestUtils.getField(BaseConfig.class, "services");
    TestUtils.setField(BaseConfig.class, "services", directory);
}
Also used : TestServiceDirectory(org.onlab.osgi.TestServiceDirectory) CodecManager(org.onosproject.codec.impl.CodecManager) BaseConfig(org.onosproject.net.config.BaseConfig) BeforeClass(org.junit.BeforeClass)

Aggregations

CodecManager (org.onosproject.codec.impl.CodecManager)53 Before (org.junit.Before)48 TestServiceDirectory (org.onlab.osgi.TestServiceDirectory)35 ServiceDirectory (org.onlab.osgi.ServiceDirectory)30 LispMappingExtensionCodecRegistrator (org.onosproject.drivers.lisp.extensions.LispMappingExtensionCodecRegistrator)10 MappingCodecRegistrator (org.onosproject.mapping.MappingCodecRegistrator)7 BeforeClass (org.junit.BeforeClass)5 CodecService (org.onosproject.codec.CodecService)5 BaseConfig (org.onosproject.net.config.BaseConfig)5 DeviceService (org.onosproject.net.device.DeviceService)5 CoreService (org.onosproject.core.CoreService)2 K8sNetworkAdminService (org.onosproject.k8snetworking.api.K8sNetworkAdminService)2 MetricsService (org.onlab.metrics.MetricsService)1 ApplicationAdminService (org.onosproject.app.ApplicationAdminService)1 ClusterService (org.onosproject.cluster.ClusterService)1 ControllerNode (org.onosproject.cluster.ControllerNode)1 NodeId (org.onosproject.cluster.NodeId)1 ControlLoadSnapshotCodec (org.onosproject.cpman.codec.ControlLoadSnapshotCodec)1 LispAppDataAddress (org.onosproject.drivers.lisp.extensions.LispAppDataAddress)1 LispAsAddress (org.onosproject.drivers.lisp.extensions.LispAsAddress)1