1 package org.opendaylight.controller.md.frm.compatibility
3 import org.opendaylight.controller.forwardingrulesmanager.FlowConfig
4 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowBuilder
6 import static extension org.opendaylight.controller.sal.compability.NodeMapping.*
7 import static org.opendaylight.controller.sal.compability.MDFlowMapping.*
8 import static org.opendaylight.controller.sal.compability.ToSalConversionsUtils.*
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.FlowKey
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.flows.Flow
12 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableItem
14 import org.opendaylight.yangtools.yang.binding.Identifiable
16 class FlowConfigMapping {
18 static def toConfigurationFlow(FlowConfig sourceCfg) {
19 val it = new FlowBuilder();
20 val source = flowAdded(sourceCfg.flow);
22 action = source.action;
23 cookie = source.cookie;
24 hardTimeout = source.hardTimeout
25 idleTimeout = source.idleTimeout
28 key = new FlowKey(sourceCfg.name, node)
32 static def toFlowConfig(Flow sourceCfg) {
33 val flow = toFlow(sourceCfg);
34 val it = new FlowConfig;
35 name = sourceCfg.key.id
36 node = sourceCfg.node.toADNode();
41 static def toFlowConfig(InstanceIdentifier<?> identifier) {
42 val it = new FlowConfig()
43 val FlowKey key = ((identifier.path.get(2) as IdentifiableItem<Flow,FlowKey>).key)
45 node = key.node.toADNode();
50 static def boolean isFlowPath(InstanceIdentifier<?> path) {
51 if(path.path.size < 2) return false;
52 if (path.path.get(2) instanceof IdentifiableItem<?,?>) {
53 val IdentifiableItem<?,? extends Identifiable<?>> item = path.path.get(2) as IdentifiableItem<?,? extends Identifiable<?>>;
54 val Identifiable<?> key = item.key;
55 if (key instanceof FlowKey) {