Flow Model modified to support instruction.
Match type modified. SAL Compatibility is causing compilation problems.
Table features added. Depends on Flow instructions.
Signed-off-by: Prasanna Huddar <prasanna.huddar@ericsson.com>
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Change-Id: I9662d877ea5f2bc173e2377177f7e62f55c4904a
class FlowConfigMapping {
static def toConfigurationFlow(FlowConfig sourceCfg) {
- val it = new FlowBuilder();
val source = flowAdded(sourceCfg.flow);
-
- action = source.action;
+ val it = new FlowBuilder();
+ instructions = source.instructions;
cookie = source.cookie;
hardTimeout = source.hardTimeout
idleTimeout = source.idleTimeout
match = source.match
node = source.node
- key = new FlowKey(sourceCfg.name, node)
+ key = new FlowKey(sourceCfg.name,node);
return it.build();
}
import ietf-yang-types {prefix yang;}
import opendaylight-l2-types {prefix l2t;}
- revision "2013-08-19" {
+ revision "2013-10-26" {
description "Initial revision of flow service";
}
type int32;
}
+
+ grouping action-list {
+ list action {
+ key "order";
+ leaf order {
+ type int32;
+ }
+ uses action;
+ }
+ }
+
grouping address {
choice address {
case ipv4 {
}
}
+ grouping instruction-list {
+ list instruction {
+ key "order";
+ leaf order {
+ type int32;
+ }
+ uses instruction;
+ }
+ }
+
+ grouping instruction {
+ choice instruction {
+ case go-to-table {
+ leaf table_id {
+ type uint8;
+ }
+ }
+
+ case write-metadata {
+ leaf metadata {
+ type uint64;
+ }
+
+ leaf metadata-mask {
+ type uint64;
+ }
+ }
+
+ case write-actions {
+ uses action-list;
+ }
+
+ case apply-actions {
+ uses action-list;
+ }
+
+ case clear-actions {
+ uses action-list;
+ }
+
+ case meter {
+ leaf meter {
+ type string;
+ }
+ }
+ }
+ }
+
grouping action {
choice action {
case output-action {
leaf-list output-node-connector {
type inet:uri;
}
+
+ leaf max-length {
+ type uint16 {
+ range "0..65294";
+ }
+ }
}
case controller-action {
case set-queue-action {
leaf queue {
- type string; // TODO: define queues
+ type string;
}
}
case pop-mpls-action {
leaf ethernet-type {
- type uint16; // TODO: define ethertype type
+ type uint16; // TODO: define ethertype type
}
}
}
case push-pbb-action {
-
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
}
+ case pop-pbb-action {
+
+ }
+
case push-mpls-action {
-
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
}
-
+
+ case dec-mpls-ttl {
+ }
+
+ case dec-nw-ttl {
+ }
+
case drop-action {
}
// leaf header { //header = [TPID + TCI]
// }
}
+
+ case copy-ttl-out {
+ }
+
+ case copy-ttl-in {
+ }
+
case set-dl-dst-action {
leaf address {
type yang:mac-address;
type yang:mac-address;
}
}
+ case group-action {
+ leaf group {
+ type string;
+ }
+ }
+
case set-dl-type-action {
leaf dl-type {
type l2t:ether-type;
}
}
+
case set-next-hop-action {
uses address;
}
+
case set-nw-dst-action {
uses address;
}
+
case set-nw-src-action{
uses address;
}
+
case set-nw-tos-action {
leaf tos {
type int32;
type vlan-cfi;
}
}
+
case set-vlan-id-action {
leaf vlan-id {
type l2t:vlan-id;
}
}
+
case set-vlan-pcp-action {
leaf vlan-pcp {
type l2t:vlan-pcp;
}
}
- case sw-path-action {
- }
-
+ case sw-path-action {
+ }
}
}
container match {
uses match:match;
}
- list action {
- key "order";
- leaf order {
- type int32;
- }
- uses action;
+
+ container instructions {
+ uses instruction-list;
}
+
leaf priority {
type uint16;
}
}
leaf table_id {
- type uint64;
+ type uint8;
}
leaf buffer_id {
import ietf-yang-types {prefix yang;}
import opendaylight-l2-types {prefix l2t;}
- revision "2013-08-19" {
- description "Initial revision of flow service";
+ revision "2013-10-26" {
+ description "Initial revision of macth types";
}
grouping "mac-address-filter" {
description "IP DSCP (6 bits in ToS field).";
type inet:dscp;
}
+
leaf ip-ecn {
description "IP ECN (2 bits in ToS field).";
type uint8;
}
+
+ leaf ip-proto {
+ description "IP Proto (IPv4 or IPv6 Protocol Number).";
+ type inet:ip-version;
+ }
}
grouping "ipv4-match-fields" {
description "IPv6 source address.";
type inet:ipv6-prefix;
}
+
leaf ipv6-destination {
description "IPv6 destination address.";
type inet:ipv6-prefix;
}
+
+ leaf ipv6-nd-target {
+ description "IPv6 target address for neighbour discovery message";
+ type inet:ipv6-prefix;
+ }
+
+ leaf ipv6-flabel {
+ type inet:ipv6-flow-label;
+ }
+
+ leaf ipv6-nd-sll {
+ description "Link layer source address for neighbour discovery message";
+ type yang:mac-address;
+ }
+
+ leaf ipv6-nd-tll {
+ description "Link layer target address for neighbour discovery message";
+ type yang:mac-address;
+ }
+
+ leaf ipv6-exthdr {
+ description "IPv6 Extension Header field";
+ type uint16;
+ }
}
grouping "udp-match-fields" {
}
}
+ grouping "protocol-match-fields" {
+ leaf mpls-label {
+ description "Label in the first MPLS shim header";
+ type uint32;
+ }
+
+ leaf mpls-tc {
+ description "TC in the first MPLS shim header";
+ type uint8;
+ }
+
+ leaf mpls-bos {
+ description "BoS bit in the first MPLS shim header";
+ type uint8;
+ }
+
+ leaf pbb-isid {
+ description "I-SID in the first PBB service instance tag";
+ type uint32;
+ }
+
+ }
+
grouping "tcp-match-fields" {
leaf tcp-source-port {
description "TCP source port.";
type uint8; // Define ICMP Code
}
}
+
+ grouping "icmpv6-match-fields" {
+ leaf icmpv6-type {
+ description "ICMP type.";
+ type uint8; // Define ICMP Type
+ }
+ description "ICMP code.";
+ leaf icmpv6-code {
+ type uint8; // Define ICMP Code
+ }
+ }
grouping "arp-match-fields" {
+ leaf arp-op {
+ type uint16;
+ }
+
leaf arp-source-transport-address {
description "ARP source IPv4 address.";
type inet:ipv4-prefix;
container arp-source-hardware-address {
description "ARP source hardware address.";
presence "Match field is active and set";
- uses mac-address-filter;
+ uses mac-address-filter;
}
container arp-target-hardware-address {
description "ARP target hardware address.";
presence "Match field is active and set";
- uses mac-address-filter;
- }
- }
-
- grouping action {
- choice action {
- case output-action {
- leaf-list output-node-connector {
- type string;
- }
- }
-
- case controller-action {
- leaf max-length {
- type uint16 {
- range "0..65294";
- }
- }
- }
-
- case set-queue-action {
- leaf queue {
- type string; // TODO: define queues
- }
- }
-
- case pop-mpls-action {
- container pop-mpls {
- leaf ethernet-type {
- type uint16; // TODO: define ethertype type
- }
- }
- }
-
- case set-mpls-ttl-action {
- leaf mpls-ttl {
- type uint8;
- }
- }
-
- case set-nw-ttl-action {
- leaf nw-ttl {
- type uint8;
- }
- }
-
- case push-pbb-action {
-
- }
-
- case push-mpls-action {
-
- }
-
- case push-vlan-action {
-
- }
+ uses mac-address-filter;
}
}
-
-
+
grouping match {
+ leaf in-port {
+ type uint32;
+ }
+
+ leaf in-phy-port {
+ type uint32;
+ }
+
+ leaf metadata {
+ type uint64;
+ }
+
+ leaf tunnel-id {
+ description "Metadata associated in the logical port";
+ type uint64;
+ }
+
container "ethernet-match" {
uses "ethernet-match-fields";
}
+
container "vlan-match" {
uses "vlan-match-fields";
}
+
container "ip-match" {
uses "ip-match-fields";
}
uses "sctp-match-fields";
}
}
+
container "icmpv4-match" {
uses "icmpv4-match-fields";
}
+
+ container "icmpv6-match" {
+ uses "icmpv6-match-fields";
+ }
+
+ container "protocol-match-fields" {
+ uses "protocol-match-fields";
+ }
}
}
\ No newline at end of file
--- /dev/null
+module opendaylight-table-types {
+ namespace "urn:opendaylight:table:types";
+ prefix table;
+
+ import ietf-inet-types {prefix inet;}
+ import ietf-yang-types {prefix yang;}
+ import opendaylight-flow-types {prefix flow;}
+
+
+ revision "2013-10-26" {
+ description "Initial revision of table service";
+ }
+
+ typedef table-ref {
+ type instance-identifier;
+ }
+
+ typedef table-config {
+ type bits {
+ bit DEPRECATED-MASK;
+ }
+ }
+
+ grouping table-feature-prop-type {
+ choice table-feature-prop-type {
+ case instructions {
+ container instructions {
+ uses flow:instruction-list;
+ }
+ }
+
+ case instructions-miss {
+ container instructions-miss {
+ uses flow:instruction-list;
+ }
+ }
+
+ case next-table {
+ container tables {
+ list table-id {
+ key "table";
+
+ leaf table-id {
+ type table-ref;
+ }
+ }
+ }
+ }
+
+ case next-table-miss {
+ container tables {
+ list table-id {
+ key "table-id";
+
+ leaf table-id {
+ type table-ref;
+ }
+ }
+ }
+ }
+
+ case write-actions {
+ container write-actions {
+ uses flow:action-list;
+ }
+ }
+
+ case write-actions-miss {
+ container write-actions-miss {
+ uses flow:action-list;
+ }
+ }
+
+ case apply-actions {
+ container apply-actions {
+ uses flow:action-list;
+ }
+ }
+
+ case apply-actions-miss {
+ container apply-actions-miss {
+ uses flow:action-list;
+ }
+ }
+
+ case match {
+ container matches {
+ leaf-list match {
+ type uint32;
+ }
+ }
+ }
+
+ case wildcards {
+ container wildcards {
+ leaf-list wildcard {
+ type uint32;
+ }
+ }
+ }
+
+ case write-setfield {
+ container write-setfield {
+ leaf-list setfield {
+ type uint32;
+ }
+ }
+ }
+
+ case write-setfield-miss {
+ container write-setfield-miss {
+ leaf-list setfield {
+ type uint32;
+ }
+ }
+ }
+
+ case apply-setfield {
+ container apply-setfield {
+ leaf-list setfield {
+ type uint32;
+ }
+ }
+ }
+
+ case apply-setfield-miss {
+ container apply-setfield-miss {
+ leaf-list setfield {
+ type uint32;
+ }
+ }
+ }
+ }
+ }
+
+ grouping table-features {
+ list table-features {
+ key "table-id";
+
+ leaf table-id {
+ type table-ref;
+ }
+
+ leaf name {
+ description "Name of the table";
+ type string;
+ }
+
+ leaf metadata-match {
+ description "Bits of metadata table can match";
+ type uint64;
+ }
+
+ leaf metadata-write {
+ description "Bits of metadata table can write";
+ type uint64;
+ }
+
+ leaf max-entries {
+ description "Max number of entries supported";
+ type uint32;
+ }
+
+ leaf config {
+ description "Bitmap of OFPTC_ values";
+ type table-config;
+ }
+
+ container table-properties {
+ list instruction-id {
+ key "order";
+ leaf order {
+ type int32;
+ }
+
+ uses table-feature-prop-type;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
container flows {
list flow {
- key "id node";
-
+ key "node id";
+
leaf id {
type string;
}
--- /dev/null
+module table-management {
+ namespace "urn:opendaylight:table:config";
+ prefix table-cfg;
+
+ import opendaylight-inventory {prefix inv;}
+ import opendaylight-table-types {prefix table;}
+
+ revision "2013-10-24" {
+ description "Initial revision of table service";
+ }
+
+ grouping table-entry {
+
+ leaf node {
+ type inv:node-ref;
+ }
+
+ uses table:table-features;
+ }
+
+ container tables {
+ list table {
+ key "id node";
+
+ leaf id {
+ type string;
+ }
+
+ uses table-entry;
+ }
+ }
+}
\ No newline at end of file
notification flow-removed {
uses node-flow;
}
-
- augment "/inv:nodes/inv:node" {
- ext:augment-identifier "flow-capable-node";
- container flow-tables {
- list table {
- key "id";
- leaf "id" {
- type inet:uri;
- }
- }
- }
- }
}
\ No newline at end of file
--- /dev/null
+module sal-table {
+ namespace "urn:opendaylight:table:service";
+ prefix table;
+
+ import yang-ext {prefix ext;}
+ import opendaylight-inventory {prefix inv;}
+ import opendaylight-table-types {prefix table-type;}
+
+ revision "2013-10-26" {
+ description "Initial revision of table service";
+ }
+
+ /** Base configuration structure **/
+ grouping table-update {
+ container original-table {
+ uses table-type:table-features;
+ }
+ container updated-table {
+ uses table-type:table-features;
+ }
+ }
+
+ rpc update-table {
+ input {
+ leaf node {
+ ext:context-reference "inv:node-context";
+ type inv:node-ref;
+ }
+ uses table-update;
+ }
+ }
+}
\ No newline at end of file
import java.util.Arrays;
import java.util.List;
-import org.opendaylight.controller.sal.action.*;
import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.flowprogrammer.Flow;
+
import org.opendaylight.controller.sal.match.Match;
import org.opendaylight.controller.sal.match.MatchField;
import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.controller.sal.utils.NetUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.*;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder;
+
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpSourceHardwareAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpTargetHardwareAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetDestinationBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetSourceBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.SctpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.TcpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.vlan.match.fields.VlanIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
+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._3.match.Ipv6MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
+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.match.layer._4.match.UdpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
import com.google.common.net.InetAddresses;
+
+
+
+
import static org.opendaylight.controller.sal.compability.ProtocolConstants.*;
import static org.opendaylight.controller.sal.compability.NodeMapping.*;
return null;
}
- public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Match toMatch(
+ public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match toMatch(
Match sourceMatch) {
if (sourceMatch != null) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.MatchBuilder targetBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.MatchBuilder();
+ MatchBuilder targetBuilder = new MatchBuilder();
targetBuilder.setEthernetMatch(ethernetMatch(sourceMatch));
targetBuilder.setIpMatch(ipMatch(sourceMatch));
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.ControllerActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.DropActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.FloodActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.FloodAllActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.HwPathActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.LoopbackActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.OutputActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.PopVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.PushVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetDlDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetDlSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetDlTypeActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetNextHopActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetNwDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetNwSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetNwTosActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetTpDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetTpSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetVlanCfiActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetVlanIdActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SetVlanPcpActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.SwPathActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4Builder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6Builder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.ActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.ControllerActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.DropActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.FloodActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.FloodAllActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.HwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.LoopbackActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.OutputActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PopVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PushVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlTypeActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNextHopActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwTosActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetTpDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetTpSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanCfiActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanIdActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanPcpActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4Builder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6Builder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.ActionBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp
import static extension org.opendaylight.controller.sal.compability.NodeMapping.*
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder
+import java.util.Collections
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.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
public class MDFlowMapping {
for (sourceAction : sourceActions) {
targetActions.add(sourceAction.toAction());
}
- action = targetActions;
+ instructions = targetActions.toApplyInstruction();
match = sourceFlow.match.toMatch();
return it.build();
}
+
+ public static def Instructions toApplyInstruction(ArrayList<Action> actions) {
+ val it = new InstructionsBuilder;
+ val applyActions = new InstructionBuilder;
+ applyActions.instruction = new ApplyActionsBuilder().setAction(actions).build()
+ instruction = Collections.<Instruction>singletonList(applyActions.build)
+ return it.build;
+ }
public static def flowStatisticsInput(Node sourceNode, Flow sourceFlow) {
- val it = new GetFlowStatisticsInputBuilder();
val source = flowAdded(sourceFlow);
- action = (source.getAction());
- cookie = (source.getCookie());
- hardTimeout = (source.getHardTimeout());
- match = (source.getMatch());
- priority = (source.getPriority());
+ val it = new GetFlowStatisticsInputBuilder(source);
node = sourceNode.toNodeRef();
return it.build();
}
public static def removeFlowInput(Node sourceNode, Flow sourceFlow) {
- val it = new RemoveFlowInputBuilder();
val source = flowAdded(sourceFlow);
- action = (source.getAction());
- cookie = (source.getCookie());
- hardTimeout = (source.getHardTimeout());
- match = (source.getMatch());
- priority = (source.getPriority());
- node = sourceNode.toNodeRef();
+ val it = new RemoveFlowInputBuilder(source);
return it.build();
}
public static def addFlowInput(Node sourceNode, Flow sourceFlow) {
- val it = new AddFlowInputBuilder();
val source = flowAdded(sourceFlow);
- action = (source.getAction());
- cookie = (source.getCookie());
- hardTimeout = (source.getHardTimeout());
- match = (source.getMatch());
- priority = (source.getPriority());
- node = sourceNode.toNodeRef()
+ val it = new AddFlowInputBuilder(source);
return it.build();
}
public static def updateFlowInput(Node sourceNode, Flow oldFlow, Flow newFlow) {
val it = new UpdateFlowInputBuilder();
-
- val original = new OriginalFlowBuilder();
-
val sourceOld = flowAdded(newFlow);
- original.action = (sourceOld.getAction());
- original.cookie = (sourceOld.getCookie());
- original.hardTimeout = (sourceOld.getHardTimeout());
- original.match = (sourceOld.getMatch());
- original.priority = (sourceOld.getPriority());
-
- val updated = new UpdatedFlowBuilder();
+ val original = new OriginalFlowBuilder(sourceOld);
val sourceNew = flowAdded(newFlow);
-
- updated.action = (sourceNew.getAction());
- updated.cookie = (sourceNew.getCookie());
- updated.hardTimeout = (sourceNew.getHardTimeout());
- updated.match = (sourceNew.getMatch());
- updated.priority = (sourceNew.getPriority());
-
+ val updated = new UpdatedFlowBuilder(sourceNew);
originalFlow = original.build()
updatedFlow = updated.build();
node = sourceNode.toNodeRef()
import java.net.InetAddress;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.opendaylight.controller.sal.action.*;
import org.opendaylight.controller.sal.match.Match;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.*;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.ActionList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.MacAddressFilter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpSourceHardwareAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpTargetHardwareAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.EthernetType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.SctpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.TcpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.vlan.match.fields.VlanId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.MacAddressFilter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch;
+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.Ipv6Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanId;
import com.google.common.net.InetAddresses;
}
- public static Flow toFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.Flow source) {
+ public static Flow toFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) {
final Flow target = new Flow();
Integer hardTimeout = source.getHardTimeout();
target.setMatch(toMatch(source.getMatch()));
- List<Action> actions = source.getAction();
+ List<Action> actions = getAction(source);
if (actions != null) {
target.setActions(actionFrom(actions));
}
return target;
}
+ public static List<Action> getAction(
+ org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow source) {
+ if (source.getInstructions() != null) {
+ for (Instruction instruction : source.getInstructions().getInstruction()) {
+ if (instruction.getInstruction() instanceof ActionList) {
+ return (((ActionList) instruction.getInstruction()).getAction());
+ }
+ }
+ }
+ // TODO Auto-generated method stub
+ return Collections.emptyList();
+ }
+
public static List<org.opendaylight.controller.sal.action.Action> actionFrom(List<Action> actions) {
List<org.opendaylight.controller.sal.action.Action> targetAction = new ArrayList<>();
for (Action action : actions) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.Action sourceAction = action
+ org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.Action sourceAction = action
.getAction();
if (sourceAction instanceof ControllerAction) {
} else if (sourceAction instanceof SetDlDstAction) {
MacAddress addressL2Dest = ((SetDlDstAction) sourceAction).getAddress();
if (addressL2Dest != null) {
- targetAction.add(new SetDlDst(bytesFrom(addressL2Dest)));
+ targetAction.add(new SetDlDst(bytesFrom(addressL2Dest)));
}
} else if (sourceAction instanceof SetDlSrcAction) {
MacAddress addressL2Src = ((SetDlSrcAction) sourceAction).getAddress();
if (addressL2Src != null) {
- targetAction.add(new SetDlSrc(bytesFrom(addressL2Src)));
-
+ targetAction.add(new SetDlSrc(bytesFrom(addressL2Src)));
+
}
} else if (sourceAction instanceof SetDlTypeAction) {
EtherType dlType = ((SetDlTypeAction) sourceAction).getDlType();
return null;
}
- public static Match toMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Match source) {
+ public static Match toMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match source) {
Match target = new Match();
if (source != null) {
fillFrom(target, source.getVlanMatch());
private static byte[] bytesFrom(MacAddress address) {
String[] mac = address.getValue().split(":");
- byte[] macAddress = new byte[6]; // mac.length == 6 bytes
- for(int i = 0; i < mac.length; i++) {
+ byte[] macAddress = new byte[6]; // mac.length == 6 bytes
+ for (int i = 0; i < mac.length; i++) {
macAddress[i] = Integer.decode("0x" + mac[i]).byteValue();
}
return macAddress;
import org.opendaylight.controller.sal.match.Match;
import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.Layer3Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.Layer4Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.SctpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.TcpMatch;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch;
+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.Ipv6Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
import com.google.common.net.InetAddresses;
checkOdMatch(odNodeFlow.getMatch(), MtchType.udp);
}
- private void checkOdMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Match match,
+ private void checkOdMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match match,
MtchType mt) {
switch (mt) {
case arp:
assertEquals("Iddle timeout is incorrect.", 32766, odNodeFlow.getIdleTimeout().shortValue());
assertEquals("Priority is incorrect.", 32767, odNodeFlow.getPriority().shortValue());
- checkOdActions(odNodeFlow.getAction());
+ checkOdActions(ToSalConversionsUtils.getAction(odNodeFlow));
}
private void checkOdActions(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action> actions) {
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action> actions) {
checkOdAction(actions, FloodAction.class, false);
checkOdAction(actions, FloodAllAction.class, false);
checkOdAction(actions, HwPathAction.class, false);
}
private void checkOdAction(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action> actions, Class<?> cl,
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action> actions, Class<?> cl,
boolean b) {
int numOfFoundActions = 0;
- for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action action : actions) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.Action innerAction = action
+ for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action action : actions) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.Action innerAction = action
.getAction();
if (cl.isInstance(innerAction)) {
numOfFoundActions++;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.action.action.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.address.address.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.ActionBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.Match;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev130819.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+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.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpSourceHardwareAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.arp.match.fields.ArpTargetHardwareAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.ethernet.match.fields.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.ArpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv4MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._3.match.Ipv6MatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.SctpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.TcpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.match.layer._4.match.UdpMatchBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev130819.vlan.match.fields.VlanIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
+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._3.match.Ipv6MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
+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.match.layer._4.match.UdpMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsBuilder;
import com.google.common.net.InetAddresses;
+
import static org.opendaylight.controller.sal.compability.ProtocolConstants.ETHERNET_ARP;
import static org.opendaylight.controller.sal.compability.ProtocolConstants.SCTP;
import static org.opendaylight.controller.sal.compability.ProtocolConstants.TCP;
odNodeFlowBuilder.setHardTimeout(32767);
odNodeFlowBuilder.setIdleTimeout(32767);
odNodeFlowBuilder.setPriority(32767);
- odNodeFlowBuilder.setAction(prepareOdActions());
+ odNodeFlowBuilder.setInstructions(prepareOdActions());
return odNodeFlowBuilder;
}
return odNodeFlowBuilder.build();
}
- private List<Action> prepareOdActions() {
+ private Instructions prepareOdActions() {
List<Action> odActions = new ArrayList<>();
ControllerActionBuilder controllerActionBuilder = new ControllerActionBuilder();
odActions.add(new ActionBuilder().setAction(setVlanPcpActionBuilder.build()).build());
odActions.add(new ActionBuilder().setAction(swPathActionBuilder.build()).build());
- return odActions;
+
+ ApplyActions innerInst = new ApplyActionsBuilder().setAction(odActions).build();
+ Instruction applyActions = new InstructionBuilder().setInstruction(innerInst).build();
+ List<Instruction> instructions = Collections.singletonList(applyActions );
+ InstructionsBuilder instBuilder = new InstructionsBuilder();
+
+ instBuilder.setInstruction(instructions);
+
+ return instBuilder.build();
}
private void prepareActionSetVlanPcp(SetVlanPcpActionBuilder setVlanPcpActionBuilder) {