Search in sources :

Example 11 with KryoNamespace

use of org.onlab.util.KryoNamespace in project onos by opennetworkinglab.

the class DistributedWorkplaceStore method activate.

@Activate
public void activate() {
    appId = coreService.registerApplication("org.onosproject.workplacestore");
    log.info("appId=" + appId);
    KryoNamespace workplaceNamespace = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(WorkflowData.class).register(Workplace.class).register(DefaultWorkplace.class).register(WorkflowContext.class).register(DefaultWorkflowContext.class).register(SystemWorkflowContext.class).register(WorkflowState.class).register(ProgramCounter.class).register(DataModelTree.class).register(JsonDataModelTree.class).register(List.class).register(ArrayList.class).register(JsonNode.class).register(ObjectNode.class).register(TextNode.class).register(LinkedHashMap.class).register(ArrayNode.class).register(BaseJsonNode.class).register(BigIntegerNode.class).register(BinaryNode.class).register(BooleanNode.class).register(ContainerNode.class).register(DecimalNode.class).register(DoubleNode.class).register(FloatNode.class).register(IntNode.class).register(JsonNodeType.class).register(LongNode.class).register(MissingNode.class).register(NullNode.class).register(NumericNode.class).register(POJONode.class).register(ShortNode.class).register(ValueNode.class).register(JsonNodeCreator.class).register(JsonNodeFactory.class).build();
    localWorkplaceMap.clear();
    workplaceMap = storageService.<String, WorkflowData>consistentMapBuilder().withSerializer(Serializer.using(workplaceNamespace)).withName("workplace-map").withApplicationId(appId).build();
    workplaceMap.addListener(workplaceMapEventListener);
    localContextMap.clear();
    contextMap = storageService.<String, WorkflowData>consistentMapBuilder().withSerializer(Serializer.using(workplaceNamespace)).withName("workflow-context-map").withApplicationId(appId).build();
    contextMap.addListener(contextMapEventListener);
    workplaceMapEventListener.syncLocal();
    contextMapEventListener.syncLocal();
    log.info("Started");
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) DefaultWorkflowContext(org.onosproject.workflow.api.DefaultWorkflowContext) WorkflowContext(org.onosproject.workflow.api.WorkflowContext) SystemWorkflowContext(org.onosproject.workflow.api.SystemWorkflowContext) JsonDataModelTree(org.onosproject.workflow.api.JsonDataModelTree) ArrayList(java.util.ArrayList) BaseJsonNode(com.fasterxml.jackson.databind.node.BaseJsonNode) DoubleNode(com.fasterxml.jackson.databind.node.DoubleNode) POJONode(com.fasterxml.jackson.databind.node.POJONode) Workplace(org.onosproject.workflow.api.Workplace) DefaultWorkplace(org.onosproject.workflow.api.DefaultWorkplace) LongNode(com.fasterxml.jackson.databind.node.LongNode) LinkedHashMap(java.util.LinkedHashMap) JsonNodeFactory(com.fasterxml.jackson.databind.node.JsonNodeFactory) SystemWorkflowContext(org.onosproject.workflow.api.SystemWorkflowContext) IntNode(com.fasterxml.jackson.databind.node.IntNode) BinaryNode(com.fasterxml.jackson.databind.node.BinaryNode) ValueNode(com.fasterxml.jackson.databind.node.ValueNode) KryoNamespace(org.onlab.util.KryoNamespace) ContainerNode(com.fasterxml.jackson.databind.node.ContainerNode) ProgramCounter(org.onosproject.workflow.api.ProgramCounter) NullNode(com.fasterxml.jackson.databind.node.NullNode) Activate(org.osgi.service.component.annotations.Activate)

Example 12 with KryoNamespace

use of org.onlab.util.KryoNamespace in project onos by opennetworkinglab.

the class AbstractDistributedP4RuntimeMirror method activate.

@Activate
public void activate() {
    final String fullMapName = format(MAP_NAME_TEMPLATE, mapSimpleName());
    final KryoNamespace serializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(TimedEntry.class).build();
    mirrorMap = storageService.<PiHandle, TimedEntry<E>>eventuallyConsistentMapBuilder().withName(fullMapName).withSerializer(serializer).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    annotationsMap = storageService.<PiHandle, Annotations>eventuallyConsistentMapBuilder().withName(fullMapName + "-annotations").withSerializer(serializer).withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
    pipeconfWatchdogService.addListener(pipeconfListener);
    log.info("Started");
}
Also used : WallClockTimestamp(org.onosproject.store.service.WallClockTimestamp) KryoNamespace(org.onlab.util.KryoNamespace) Activate(org.osgi.service.component.annotations.Activate)

Example 13 with KryoNamespace

use of org.onlab.util.KryoNamespace in project dhcpl2relay by opencord.

the class DhcpL2Relay method activate.

@Activate
protected void activate(ComponentContext context) {
    // start the dhcp relay agent
    appId = coreService.registerApplication(DHCP_L2RELAY_APP);
    componentConfigService.registerProperties(getClass());
    eventDispatcher.addSink(DhcpL2RelayEvent.class, listenerRegistry);
    KryoNamespace serializer = KryoNamespace.newBuilder().register(KryoNamespaces.API).register(Instant.class).register(DHCP.MsgType.class).register(DhcpAllocationInfo.class).build();
    allocations = storageService.<String, DhcpAllocationInfo>consistentMapBuilder().withName("dhcpl2relay-allocations").withSerializer(Serializer.using(serializer)).withApplicationId(appId).build();
    dhcpL2RelayCounters.setDelegate(delegate);
    eventHandlerExecutor = newSingleThreadExecutor(groupedThreads("onos/dhcp", "dhcp-event-%d", log));
    cfgService.addListener(cfgListener);
    mastershipService.addListener(changeListener);
    deviceService.addListener(deviceListener);
    if (sadisService != null) {
        subsService = sadisService.getSubscriberInfoService();
    } else {
        log.warn(SADIS_NOT_RUNNING);
    }
    factories.forEach(cfgService::registerConfigFactory);
    // update the dhcp server configuration.
    updateConfig();
    if (context != null) {
        modified(context);
    }
    // add the packet services.
    packetService.addProcessor(dhcpRelayPacketProcessor, PacketProcessor.director(0));
    log.info("DHCP-L2-RELAY Started");
}
Also used : Instant(java.time.Instant) KryoNamespace(org.onlab.util.KryoNamespace) DhcpAllocationInfo(org.opencord.dhcpl2relay.DhcpAllocationInfo) DHCP(org.onlab.packet.DHCP) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

KryoNamespace (org.onlab.util.KryoNamespace)13 Activate (org.osgi.service.component.annotations.Activate)7 EqualsTester (com.google.common.testing.EqualsTester)4 ByteBuffer (java.nio.ByteBuffer)4 Test (org.junit.Test)4 Timestamp (org.onosproject.store.Timestamp)3 WallClockTimestamp (org.onosproject.store.service.WallClockTimestamp)2 BaseJsonNode (com.fasterxml.jackson.databind.node.BaseJsonNode)1 BinaryNode (com.fasterxml.jackson.databind.node.BinaryNode)1 ContainerNode (com.fasterxml.jackson.databind.node.ContainerNode)1 DoubleNode (com.fasterxml.jackson.databind.node.DoubleNode)1 IntNode (com.fasterxml.jackson.databind.node.IntNode)1 JsonNodeFactory (com.fasterxml.jackson.databind.node.JsonNodeFactory)1 LongNode (com.fasterxml.jackson.databind.node.LongNode)1 NullNode (com.fasterxml.jackson.databind.node.NullNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 POJONode (com.fasterxml.jackson.databind.node.POJONode)1 ValueNode (com.fasterxml.jackson.databind.node.ValueNode)1 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1