package org.opendaylight.controller.forwardingrulesmanager;
-import java.io.Serializable;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
import org.opendaylight.controller.sal.action.Action;
import org.opendaylight.controller.sal.action.ActionType;
import org.opendaylight.controller.sal.action.Controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Configuration Java Object which represents a flow configuration information
* for Forwarding Rules Manager.
}
Flow flow = new Flow(match, getActionList());
+
if (this.cookie != null) {
flow.setId(Long.parseLong(cookie));
}
if (this.priority != null) {
flow.setPriority(Integer.decode(this.priority).shortValue());
}
+
+
return flow;
}
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal</artifactId>
- <version>0.5.1-SNAPSHOT</version>
+ <version>0.7.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>sal-binding-util</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>clustering.services</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
<packaging>bundle</packaging>
import org.opendaylight.controller.sal.utils.GlobalConstants
import org.opendaylight.controller.sal.utils.INodeConnectorFactory
import org.opendaylight.controller.sal.utils.INodeFactory
+import org.opendaylight.controller.clustering.services.IClusterGlobalServices
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService
.setService(IPluginOutFlowProgrammerService) //
.setCallbacks("setFlowProgrammerPublisher", "setFlowProgrammerPublisher") //
.setRequired(false))
+
+ add(
+ createServiceDependency() //
+ .setService(IClusterGlobalServices) //
+ .setCallbacks("setClusterGlobalServices", "unsetClusterGlobalServices") //
+ .setRequired(false))
+
}
private def dispatch configure(InventoryAndReadAdapter imp, Component it) {
.setService(IDiscoveryService) //
.setCallbacks("setDiscoveryPublisher", "setDiscoveryPublisher") //
.setRequired(false))
+
}
package org.opendaylight.controller.sal.compatibility
+import java.util.Map
+import java.util.UUID
import java.util.concurrent.ExecutionException
+import java.util.concurrent.ConcurrentHashMap
+import java.util.concurrent.Future
+import java.util.EnumSet
import org.opendaylight.controller.sal.core.Node
import org.opendaylight.controller.sal.flowprogrammer.Flow
import org.opendaylight.controller.sal.flowprogrammer.IPluginInFlowProgrammerService
import org.opendaylight.controller.sal.flowprogrammer.IPluginOutFlowProgrammerService
import org.opendaylight.controller.sal.utils.Status
import org.opendaylight.controller.sal.utils.StatusCode
+import org.opendaylight.controller.clustering.services.CacheExistException
+import org.opendaylight.controller.clustering.services.IClusterGlobalServices
+import org.opendaylight.controller.clustering.services.IClusterServices
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SwitchFlowRemoved
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService
import org.opendaylight.controller.md.sal.common.api.TransactionStatus
-import org.opendaylight.controller.md.sal.common.api.data.DataModification
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey
-import org.opendaylight.yangtools.yang.binding.DataObject
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId
import static extension org.opendaylight.controller.sal.compatibility.MDFlowMapping.*
class FlowProgrammerAdapter implements IPluginInFlowProgrammerService, SalFlowListener {
private static val LOG = LoggerFactory.getLogger(FlowProgrammerAdapter);
+ private static val CACHE_NAME = "flowprogrammeradapter.flowtoid";
@Property
private SalFlowService delegate;
@Property
private IPluginOutFlowProgrammerService flowProgrammerPublisher;
+ @Property
+ private IClusterGlobalServices clusterGlobalServices;
+
+
+ @Property
+ private Map<Flow, UUID> flowToFlowId = new ConcurrentHashMap<Flow, UUID>();
+
+
override addFlow(Node node, Flow flow) {
- return addFlowAsync(node,flow,0)
+ return toFutureStatus(internalAddFlowAsync(node,flow,0));
}
override modifyFlow(Node node, Flow oldFlow, Flow newFlow) {
- return modifyFlowAsync(node, oldFlow,newFlow,0)
+ return toFutureStatus(internalModifyFlowAsync(node, oldFlow,newFlow,0));
}
override removeFlow(Node node, Flow flow) {
- return removeFlowAsync(node, flow,0);
+ return toFutureStatus(internalRemoveFlowAsync(node, flow,0));
}
override addFlowAsync(Node node, Flow flow, long rid) {
- writeFlow(flow.toMDFlow, new NodeKey(new NodeId(node.getNodeIDString())));
+ internalAddFlowAsync(node, flow, rid);
return toStatus(true);
}
override modifyFlowAsync(Node node, Flow oldFlow, Flow newFlow, long rid) {
- writeFlow(newFlow.toMDFlow, new NodeKey(new NodeId(node.getNodeIDString())));
+ internalModifyFlowAsync(node, oldFlow, newFlow, rid);
return toStatus(true);
}
- override removeFlowAsync(Node node, Flow adflow, long rid) {
- val flow = adflow.toMDFlow;
- val modification = this._dataBrokerService.beginTransaction();
- val flowPath = InstanceIdentifier.builder(Nodes)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, new NodeKey(new NodeId(node.getNodeIDString())))
- .augmentation(FlowCapableNode)
- .child(Table, new TableKey(flow.getTableId()))
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow, new FlowKey(flow.id))
- .build;
- modification.removeConfigurationData(flowPath);
- val commitFuture = modification.commit();
+ override removeFlowAsync(Node node, Flow flow, long rid) {
+ internalRemoveFlowAsync(node, flow, rid);
return toStatus(true);
}
}
}
-
- private def writeFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow flow, NodeKey nodeKey) {
- val modification = this._dataBrokerService.beginTransaction();
- val flowPath = InstanceIdentifier.builder(Nodes)
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, nodeKey)
- .augmentation(FlowCapableNode)
- .child(Table, new TableKey(flow.getTableId()))
- .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow, new FlowKey(flow.id))
- .build;
- modification.putConfigurationData(flowPath, flow);
- val commitFuture = modification.commit();
- try {
- val result = commitFuture.get();
- val status = result.getResult();
- } catch (InterruptedException e) {
- LOG.error(e.getMessage(), e);
- } catch (ExecutionException e) {
- LOG.error(e.getMessage(), e);
- }
- }
-
public static def toStatus(RpcResult<?> result) {
return toStatus(result.isSuccessful());
}
NodeExperimenterErrorNotification notification) {
// NOOP : Not supported by AD SAL
}
+
+ private def Future<RpcResult<TransactionStatus>> writeFlowAsync(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow flow, NodeKey nodeKey){
+ val modification = this._dataBrokerService.beginTransaction();
+ val flowPath = InstanceIdentifier.builder(Nodes)
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, nodeKey)
+ .augmentation(FlowCapableNode)
+ .child(Table, new TableKey(flow.getTableId()))
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow, new FlowKey(flow.id))
+ .build;
+ modification.putConfigurationData(flowPath, flow);
+ return modification.commit();
+ }
+
+ private def Future<RpcResult<TransactionStatus>> internalAddFlowAsync(Node node, Flow flow, long rid){
+ var flowId = getCache().get(flow);
+ if(flowId != null) {
+ removeFlow(node, flow);
+ return internalAddFlowAsync(node, flow, rid);
+ }
+
+ flowId = UUID.randomUUID();
+ getCache().put(flow, flowId);
+
+ return writeFlowAsync(flow.toMDFlow(flowId.toString()), new NodeKey(new NodeId(node.getNodeIDString())));
+ }
+
+ private def Future<RpcResult<TransactionStatus>> internalModifyFlowAsync(Node node, Flow oldFlow, Flow newFlow, long rid) {
+ val flowId = getCache().remove(oldFlow);
+ if(flowId == null){
+ throw new IllegalArgumentException("oldFlow is unknown");
+ }
+
+ getCache().put(newFlow, flowId);
+ return writeFlowAsync(newFlow.toMDFlow(flowId.toString()), new NodeKey(new NodeId(node.getNodeIDString())));
+ }
+
+
+ private def Future<RpcResult<TransactionStatus>> internalRemoveFlowAsync(Node node, Flow adflow, long rid){
+ val flowId = getCache().remove(adflow);
+ if(flowId == null){
+ throw new IllegalArgumentException("adflow is unknown");
+ }
+ val flow = adflow.toMDFlow(flowId.toString());
+ val modification = this._dataBrokerService.beginTransaction();
+ val flowPath = InstanceIdentifier.builder(Nodes)
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node, new NodeKey(new NodeId(node.getNodeIDString())))
+ .augmentation(FlowCapableNode)
+ .child(Table, new TableKey(flow.getTableId()))
+ .child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow, new FlowKey(flow.id))
+ .build;
+ modification.removeConfigurationData(flowPath);
+ return modification.commit();
+ }
+
+ private def toFutureStatus(Future<RpcResult<TransactionStatus>> future){
+ try {
+ val result = future.get();
+ return toStatus(result);
+ } catch (InterruptedException e) {
+ return processException(e);
+ } catch (ExecutionException e) {
+ return processException(e);
+ } catch (Exception e){
+ processException(e);
+ }
+ return toStatus(false);
+ }
+
+ private def Map<Flow, UUID> getCache(){
+ if(clusterGlobalServices == null){
+ return new ConcurrentHashMap<Flow, UUID>();
+ }
+
+ var cache = clusterGlobalServices.getCache(CACHE_NAME);
+
+ if(cache == null) {
+ try {
+ cache = clusterGlobalServices.createCache(CACHE_NAME, EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+ } catch (CacheExistException e) {
+ cache = clusterGlobalServices.getCache(CACHE_NAME);
+ }
+ }
+ return cache as Map<Flow, UUID>;
+
+ }
+
}
for(flow : table.flow){
val adsalFlow = ToSalConversionsUtils.toFlow(flow);
- val statsFromDataStore = flow.getAugmentation(FlowStatisticsData) as FlowStatisticsData;
+ val statsFromDataStore = flow.getAugmentation(FlowStatisticsData);
if(statsFromDataStore != null){
val it = new FlowOnNode(adsalFlow);
for (table : dsFlowCapableNode.table){
- val tableStats = table.getAugmentation(FlowTableStatisticsData) as FlowTableStatisticsData;
+ val tableStats = table.getAugmentation(FlowTableStatisticsData);
if(tableStats != null){
ret.add(toNodeTableStatistics(tableStats.flowTableStatistics,table.id,node));
for(mdsalFlow : table.flow){
if(FromSalConversionsUtils.flowEquals(mdsalFlow, MDFlowMapping.toMDSalflow(targetFlow))){
- val statsFromDataStore = mdsalFlow.getAugmentation(FlowStatisticsData) as FlowStatisticsData;
+ val statsFromDataStore = mdsalFlow.getAugmentation(FlowStatisticsData);
if(statsFromDataStore != null){
LOG.debug("Found matching flow in the data store flow table ");
val table= it.readConfigurationData(tableRef) as Table;
if(table != null){
- val tableStats = table.getAugmentation(FlowTableStatisticsData) as FlowTableStatisticsData;
+ val tableStats = table.getAugmentation(FlowTableStatisticsData);
if(tableStats != null){
nodeStats = toNodeTableStatistics(tableStats.flowTableStatistics,table.id,nodeTable.node);
}
override onNodeUpdated(NodeUpdated notification) {
- val properties = Collections.<org.opendaylight.controller.sal.core.Property>emptySet();
val InstanceIdentifier<? extends DataObject> identifier = notification.nodeRef.value as InstanceIdentifier<? extends DataObject>;
var updateType = UpdateType.CHANGED;
* OpendaylightFlowStatisticsListener interface implementation
*/
override onAggregateFlowStatisticsUpdate(AggregateFlowStatisticsUpdate notification) {
- throw new UnsupportedOperationException("TODO: auto-generated method stub")
+ //Ignoring this notification as there does not seem to be a way to bubble this up to AD-SAL
}
override onFlowsStatisticsUpdate(FlowsStatisticsUpdate notification) {
return it;
}
+
+ override getConfiguredNotConnectedNodes() {
+ return Collections.emptySet();
+ }
}
}
- public static def toMDFlow(Flow sourceFlow) {
+ public static def toMDFlow(Flow sourceFlow, String flowId) {
if (sourceFlow == null)
throw new IllegalArgumentException();
val it = new FlowBuilder();
idleTimeout = sourceFlow.idleTimeout as int
cookie = BigInteger.valueOf(sourceFlow.id)
priority = sourceFlow.priority as int
- id = new FlowId(sourceFlow.id)
+ id = new FlowId(flowId)
val sourceActions = sourceFlow.actions;
val targetActions = new ArrayList<Action>();
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri
class FlowTransaction extends AbstractTransaction {
@Property
- val SalFlowService salFlowService;
+ val SalFlowService salFlowService;
+
new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalFlowService salFlowService) {
- super(modification)
+ super(modification)
_salFlowService = salFlowService;
}
val tableInstanceId = instanceId.firstIdentifierOf(Table);
val nodeInstanceId = instanceId.firstIdentifierOf(Node);
val builder = new RemoveFlowInputBuilder(flow);
- builder.setFlowRef(new FlowRef(instanceId));
+ builder.setFlowRef(new FlowRef(instanceId));
builder.setNode(new NodeRef(nodeInstanceId));
builder.setFlowTable(new FlowTableRef(tableInstanceId));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
_salFlowService.removeFlow(builder.build());
}
}
builder.setFlowRef(new FlowRef(instanceId));
val ufb = new UpdatedFlowBuilder(updatedFlow);
builder.setUpdatedFlow((ufb.build()));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
val ofb = new OriginalFlowBuilder(originalFlow);
builder.setOriginalFlow(ofb.build());
_salFlowService.updateFlow(builder.build());
val nodeInstanceId = instanceId.firstIdentifierOf(Node);
val builder = new AddFlowInputBuilder(flow);
builder.setNode(new NodeRef(nodeInstanceId));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
builder.setFlowRef(new FlowRef(instanceId));
builder.setFlowTable(new FlowTableRef(tableInstanceId));
_salFlowService.addFlow(builder.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node
import org.opendaylight.yangtools.yang.binding.DataObject
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri
class GroupTransaction extends AbstractTransaction {
@Property
val SalGroupService groupService;
-
+
new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalGroupService groupService) {
- super(modification)
+ super(modification)
_groupService = groupService;
}
val nodeInstanceId = instanceId.firstIdentifierOf(Node);
val builder = new RemoveGroupInputBuilder(group);
builder.setNode(new NodeRef(nodeInstanceId));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
builder.setGroupRef(new GroupRef(instanceId));
_groupService.removeGroup(builder.build());
}
builder.setGroupRef(new GroupRef(instanceId));
val ufb = new UpdatedGroupBuilder(updatedGroup);
builder.setUpdatedGroup((ufb.build()));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
val ofb = new OriginalGroupBuilder(originalGroup);
builder.setOriginalGroup(ofb.build());
_groupService.updateGroup(builder.build());
val builder = new AddGroupInputBuilder(group);
builder.setNode(new NodeRef(nodeInstanceId));
builder.setGroupRef(new GroupRef(instanceId));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
_groupService.addGroup(builder.build());
}
}
import org.opendaylight.yangtools.yang.binding.DataObject
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri
class MeterTransaction extends AbstractTransaction {
@Property
val SalMeterService salMeterService;
-
+
new(DataModification<InstanceIdentifier<? extends DataObject>, DataObject> modification,SalMeterService salMeterService) {
- super(modification)
+ super(modification)
_salMeterService = salMeterService;
}
val builder = new RemoveMeterInputBuilder(meter);
builder.setNode(new NodeRef(nodeInstanceId));
builder.setMeterRef(new MeterRef(instanceId));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
_salMeterService.removeMeter(builder.build());
}
}
builder.setMeterRef(new MeterRef(instanceId));
val ufb = new UpdatedMeterBuilder(updatedMeter);
builder.setUpdatedMeter((ufb.build()));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
val ofb = new OriginalMeterBuilder(originalMeter);
builder.setOriginalMeter(ofb.build());
_salMeterService.updateMeter(builder.build());
val builder = new AddMeterInputBuilder(meter);
builder.setNode(new NodeRef(nodeInstanceId));
builder.setMeterRef(new MeterRef(instanceId));
+ builder.setTransactionUri(new Uri(modification.getIdentifier() as String));
_salMeterService.addMeter(builder.build());
}
}
}
typedef flow-id {
- type uint32; // Note: This doesn't really belong here, and not sure if unint32 is right
+ type inet:uri;
}
grouping tables {
import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
import ietf-yang-types {prefix yang;revision-date "2010-09-24";}
import opendaylight-l2-types {prefix types;revision-date "2013-08-27";}
+ import opendaylight-match-types {prefix match-type;revision-date "2013-10-26";}
+ import opendaylight-table-types {prefix table-type;revision-date "2013-10-26";}
revision "2013-07-09" {
description "";
}
}
+ identity packet-in-reason {
+ description "Base identity for all the available packet in reason";
+ }
+
+ identity no-match {
+ base packet-in-reason;
+ description "No matching flow in the classifier";
+ }
+
+ identity send-to-controller {
+ base packet-in-reason;
+ description "Explicit instruction to send packet to controller";
+ }
+
+ identity invalid-ttl {
+ base packet-in-reason;
+ description "Packet with invalid TTL";
+ }
notification packet-received {
leaf cookie {
type cookie;
}
+
+ leaf table-id {
+ type table-type:table-id;
+ }
+
+ leaf packet-in-reason {
+ type identityref {
+ base packet-in-reason;
+ }
+ }
+
+ container match {
+ uses match-type:match;
+ }
+
uses raw-packet;
}
uses raw-packet;
}
}
-}
\ No newline at end of file
+}
import flow-node-inventory {prefix flow-node;revision-date "2013-08-19";}
import flow-capable-transaction {prefix tr;}
import sal-flow {prefix flow;}
+ import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
revision "2013-08-19" {
typedef flow-id {
description "flow id";
- type yang:counter32;
+ type inet:uri;
}
grouping flow-and-statistics-map-list {
import org.opendaylight.yangtools.concepts.ListenerRegistration\r
import org.opendaylight.yangtools.concepts.Registration\r
import org.opendaylight.yangtools.yang.binding.Notification\r
-import org.slf4j.LoggerFactory\rimport org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder
-
+import org.slf4j.LoggerFactory\r
+import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder\r
+\r
class NotificationBrokerImpl implements NotificationProviderService, AutoCloseable {\r
\r
val Multimap<Class<? extends Notification>, NotificationListener<?>> listeners;\r
val Notification notification;\r
\r
override call() {\r
+ //Only logging the complete notification in debug mode\r
try {\r
- log.info("Delivering notification {} to {}",notification,listener);\r
+ if(log.isDebugEnabled){\r
+ log.debug("Delivering notification {} to {}",notification,listener);\r
+ } else {\r
+ log.info("Delivering notification {} to {}",notification.class.name,listener);\r
+ }\r
listener.onNotification(notification);\r
- log.info("Notification delivered {} to {}",notification,listener);\r
+ if(log.isDebugEnabled){\r
+ log.debug("Notification delivered {} to {}",notification,listener);\r
+ } else {\r
+ log.info("Notification delivered {} to {}",notification.class.name,listener);\r
+ }\r
} catch (Exception e) {\r
log.error("Unhandled exception thrown by listener: {}", listener, e);\r
}\r
package org.opendaylight.controller.sal.binding.test.bugfix;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
-import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
+import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
public class FlagsSerializationTest extends AbstractDataServiceTest {
private static final QName NODE_ID_QNAME = QName.create(Node.QNAME, "id");
private static final QName FLOW_ID_QNAME = QName.create(Flow.QNAME, "id");
private static final QName FLOW_NODE_QNAME = QName.create(Flow.QNAME, "node");
- private static final long FLOW_ID = 1234;
+ private static final String FLOW_ID = "1234";
private static final short TABLE_ID = (short)0;
private static final String NODE_ID = "node:1";
package org.opendaylight.controller.sal.binding.test.connect.dom;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.Future;
-
+import com.google.common.collect.ImmutableMap;
import org.junit.Test;
import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
import org.opendaylight.controller.sal.binding.impl.connect.dom.CommitHandlersTransactions;
import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest;
import org.opendaylight.controller.sal.core.api.data.DataModificationTransaction;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpVersion;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpVersion;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.data.api.CompositeNode;
-import com.google.common.collect.ImmutableMap;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
public class ChangeOriginatedInDomBrokerTest extends AbstractDataServiceTest {
private static final QName TABLE_ID_QNAME = QName.create(Table.QNAME, "id");
private static final String NODE_ID = "node:1";
- private static final FlowId FLOW_ID = new FlowId(1234L);
+ private static final FlowId FLOW_ID = new FlowId("1234");
private static final Short TABLE_ID = Short.valueOf((short) 0);
private static final NodeKey NODE_KEY = new NodeKey(new NodeId(NODE_ID));
*/
package org.opendaylight.controller.md.statistics.manager;
-import java.util.HashMap;
-import java.util.List;
-import java.util.concurrent.ConcurrentMap;
-
import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.HashMap;
+import java.util.List;
+import java.util.concurrent.ConcurrentMap;
+
/**
* Class implement statistics manager related listener interface and augment all the
* received statistics data to data stores.
sucLogger.debug("Associated original flow is not found in data store. Augmenting flow in operational data store");
//TODO: Temporary fix: format [ 1+tableid+1+unaccounted flow counter]
long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"1"+Integer.toString(this.unaccountedFlowsCounter)));
- FlowKey newFlowKey = new FlowKey(new FlowId(flowKey));
+ FlowKey newFlowKey = new FlowKey(new FlowId(Long.toString(flowKey)));
InstanceIdentifier<Flow> flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key)
.augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(tableId))
package org.opendaylight.controller.sal.flowprogrammer;
-import java.io.Serializable;
-import java.net.Inet6Address;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
import org.opendaylight.controller.sal.action.Action;
import org.opendaylight.controller.sal.action.ActionType;
import org.opendaylight.controller.sal.action.SetDlType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+import java.net.Inet6Address;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
/**
* Represent a flow: match + actions + flow specific properties
*/
}
return true;
}
+
}