<name>Openflow Protocol Library - API</name>\r
\r
<properties>\r
- <yangtools.version>0.5.8-SNAPSHOT</yangtools.version>\r
+ <yangtools.version>0.5.9-SNAPSHOT</yangtools.version>\r
+ <yangtools.generator.version>0.6.0-SNAPSHOT</yangtools.generator.version>\r
</properties>\r
\r
<build>\r
<dependency>\r
<groupId>org.opendaylight.yangtools</groupId>\r
<artifactId>maven-sal-api-gen-plugin</artifactId>\r
- <version>${yangtools.version}</version>\r
+ <version>${yangtools.generator.version}</version>\r
<type>jar</type>\r
</dependency>\r
</dependencies>\r
description "Initial model";
}
- /*
identity output {
description " Output to switch port. ";
base oft:action;
}
identity copy_ttl_out {
- description " Copy TTL "outwards" -- from next-to-outermost to outermost ";
+ description " Copy TTL \"outwards\" -- from next-to-outermost to outermost ";
base oft:action;
}
identity copy_ttl_in {
- description " Copy TTL "inwards" -- from outermost to next-to-outermost ";
+ description " Copy TTL \"inwards\" -- from outermost to next-to-outermost ";
base oft:action;
}
identity set_mpls_ttl {
description "";
base oft:action;
}
- */
+
grouping output {
description
"Action structure for OFPAT_OUTPUT, which sends packets out 'port'.
}
grouping push-pbb {
-
+ leaf ethertype {
+ type oft:ether-type;
+ }
}
grouping push-mpls {
-
+ leaf ethertype {
+ type oft:ether-type;
+ }
}
grouping push-vlan {
-
+ leaf ethertype {
+ type oft:ether-type;
+ }
}
grouping pop-mpls {
leaf ethertype {
- type uint16; // TODO: define ethertype type
+ type oft:ether-type;
}
}
grouping action-header {
leaf type {
- type action-type;
- }
- }
-
- typedef action-type {
- /* ofp_action_type */
- type enumeration {
- enum OUTPUT {
- description "Output to switch port.";
- }
- enum SET_VLAN_VID {
- description "Set the 802.1q VLAN id.";
- }
- enum SET_VLAN_PCP {
- description "Set the 802.1q priority.";
- }
- enum STRIP_VLAN {
- description "Strip the 802.1q header.";
- }
- enum SET_DL_SRC {
- description "Ethernet source address.";
- }
- enum SET_DL_DST {
- description "Ethernet destination address.";
+ type identityref {
+ base oft:action;
}
- enum SET_NW_SRC {
- description "IP source address.";
- }
- enum SET_NW_DST {
- description "IP destination address.";
- }
- enum SET_TP_SRC {
- description "TCP/UDP source port.";
- }
- enum SET_TP_DST {
- description "TCP/UDP destination port.";
- }
- enum OFPAT_VENDOR {
- value 65535; // 0xffff
+ }
+ choice action-type {
+ case output {
+ uses output;
}
}
}
+
}
\ No newline at end of file
--- /dev/null
+module openflow-augments {\r
+ namespace "urn:opendaylight:openflow:augments";\r
+ prefix "aug";\r
+ \r
+ import openflow-protocol {prefix ofproto;}\r
+\r
+\r
+ revision "2013-10-02" {\r
+ description "Initial model";\r
+ }\r
+\r
+ //augment "/ofproto:hello-message/ofproto:hello" {\r
+ // leaf uid {\r
+ // type uint16;\r
+ // }\r
+ //} \r
+}
\ No newline at end of file
module openflow-extensible-match {
- namespace "urn:openflowopenflow:oxm";
+ namespace "urn:opendaylight:openflow:oxm";
prefix "oxm";
base oft:match-type-base;
}
-
// oxm classes
identity class {
description "Base identity for OXM classes";
// field types
- /*
+
identity match-field {
description "Base identity for OXM Fields";
}
base match-field;
description "Match for IPv6 Extension Header pseudo-field";
}
- */
+
// Abstract definitions of fields structure
grouping in-port {
}
}
+
+ grouping oxm-fields {
+ list match-entries {
+ leaf oxm-class {
+ type identityref {
+ base class;
+ }
+ }
+ leaf oxm-match-field {
+ type identityref {
+ base match-field;
+ }
+ }
+ leaf has-mask {
+ type boolean;
+ }
+ }
+ }
+
}
\ No newline at end of file
units "kbps"; \r
}\r
}\r
+ \r
+ grouping match {\r
+ leaf type {\r
+ type identityref {\r
+ base oft:match-type-base;\r
+ }\r
+ }\r
+ uses oxm:oxm-fields;\r
+ }\r
+ \r
+ \r
\r
// TODO: ofp_packat_queue\r
\r
list elements {\r
uses ofHelloElementHeader;\r
\r
+ leaf-list version-bitmap {\r
+ type boolean;\r
+ }\r
+ \r
leaf data {\r
type binary;\r
}\r
leaf exp_type {\r
type uint32;\r
}\r
+ leaf data {\r
+ type binary;\r
+ }\r
}\r
/* Switch configuration messages. */\r
grouping features-request {\r
\r
uses ofHeader;\r
\r
- leaf flags {\r
+ leaf-list flags {\r
type oft:switch-config-flag;\r
}\r
leaf miss-send-len {\r
leaf buffer-id {\r
// ID assigned by datapath.\r
type uint32;\r
- } \r
+ }\r
leaf total-len {\r
// Full length of frame.\r
type uint16;\r
// Cookie of the flow entry that was looked up.\r
type uint64;\r
}\r
- \r
- //TODO:: add match leaf\r
- // leaf match {\r
- // type oft:match\r
- // }\r
+ container match {\r
+ uses match;\r
+ }\r
\r
// struct ofp_match match; /* Packet metadata. Variable size. */\r
// /* The variable size and padded match is always followed by:\r
leaf byte-count {\r
type uint64;\r
}\r
- //TODO:: add match leaf\r
- //leaf match {\r
- // type oft:match;\r
- //}\r
+ container match {\r
+ uses match;\r
+ }\r
} \r
grouping port-status {\r
// reference "OFPT_PORT_STATUS message in Openflow Switch 1.3 Spec"\r
type uint32;\r
}\r
leaf flags {\r
- type uint16;\r
+ type oft:flow-mod-flags;\r
+ }\r
+ container match {\r
+ uses match;\r
}\r
- //TODO:: add match leaf\r
} \r
grouping group-mod {\r
// reference "OFPT_GROUP_MOD message in Openflow Switch 1.3 Spec"\r
leaf cookie-mask {\r
type uint64;\r
}\r
- leaf match {\r
- type identityref {\r
- base oft:match-type-base;\r
- }\r
+ container match {\r
+ uses match;\r
}\r
}\r
case multipart-request-aggregate {\r
leaf cookie-mask {\r
type uint64;\r
}\r
- leaf match {\r
- type identityref {\r
- base oft:match-type-base;\r
- }\r
+ container match {\r
+ uses match;\r
}\r
}\r
case multipart-request-port-stats {\r
leaf byte-count {\r
type uint64;\r
}\r
- leaf match {\r
- type uint64;\r
+ container match {\r
+ uses match;\r
}\r
}\r
}\r
leaf-list max_groups {\r
type uint32;\r
}\r
- leaf-list actions {\r
- type ofaction:action-type;\r
+ //leaf-list actions {\r
+ // type ofaction:action-type;\r
+ //}\r
+ list actions {\r
+ uses ofaction:action-header;\r
}\r
}\r
case multipart-reply-meter {\r
}\r
\r
\r
-\r
- /* Immutable messages. */\r
+ /* Immutable messages. */\r
notification hello-message {\r
uses hello;\r
// reference "OFPT_HELLO message in Openflow Switch 1.3 Spec"\r
}
enum OFPC_FRAG_REASM {
value 2;
- description "Reassemble (only if OFPC_IP_REASM set)."
+ description "Reassemble (only if OFPC_IP_REASM set).";
}
enum OFPC_FRAG_MASK {
value 3;
}
enum OFPRR_DELETE {
value 2;
- description "Evicted by a DELETE flow mod."
+ description "Evicted by a DELETE flow mod.";
}
enum OFPRR_GROUP_DELETE {
value 3;
}
}
+ typedef flow-mod-flags {
+ /* ofp_flow_mod_flags */
+ type bits {
+ bit OFPFF_SEND_FLOW_REM {
+ position 0;
+ /* Send flow removed message when flow expires or is deleted. */
+ }
+ bit OFPFF_CHECK_OVERLAP {
+ position 1;
+ /* Check for overlapping entries first. */
+ }
+ bit OFPFF_RESET_COUNTS {
+ position 2;
+ /* Reset flow packet and byte counts. */
+ }
+ bit OFPFF_NO_PKT_COUNTS {
+ position 3;
+ /* Don't keep track of packet count. */
+ }
+ bit OFPFF_NO_BYT_COUNTS {
+ position 4;
+ /* Don't keep track of byte count. */
+ }
+ }
+ }
+
typedef group-mod-command {
/* ofp_group_mod_command */
type enumeration {
public void messageToBuffer(short version, ByteBuf out,\r
SetConfigInput message) {\r
ByteBufUtils.writeOFHeader(instance, message, out);\r
- // TODO - finish implementation after enums provide needed funcionality\r
- out.writeShort(message.getFlags().getIntValue());\r
+ // TODO - finish implementation after list of enums is generated\r
+ //out.writeShort(message.getFlags().getIntValue());\r
out.writeShort(message.getMissSendLen());\r
}\r
\r
BufferHelper.checkHeaderV13(builtByFactory);\r
\r
Assert.assertEquals("Wrong bufferID", 0x00010203L, builtByFactory.getBufferId().longValue());\r
- Assert.assertEquals("Wrong totalLen", 0x0102, builtByFactory.getTotalLen().intValue());\r
+ Assert.assertEquals("Wrong totalLength", 0x0102, builtByFactory.getTotalLen().intValue());\r
Assert.assertEquals("Wrong reason", 0x01, builtByFactory.getReason().shortValue());\r
Assert.assertEquals("Wrong tableID", new TableId((long) 4), builtByFactory.getTableId());\r
Assert.assertEquals("Wrong cookie", 0x0001020304050607L, builtByFactory.getCookie().longValue());\r
\r
@Override\r
public void onEchoRequestMessage(EchoRequestMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("EchoRequest message received");\r
\r
}\r
\r
@Override\r
public void onErrorMessage(ErrorMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("Error message received");\r
\r
}\r
\r
@Override\r
public void onExperimenterMessage(ExperimenterMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("Experimenter message received");\r
\r
}\r
\r
@Override\r
public void onFlowRemovedMessage(FlowRemovedMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("FlowRemoved message received");\r
\r
}\r
\r
\r
@Override\r
public void onMultipartReplyMessage(MultipartReplyMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("MultipartReply message received");\r
\r
}\r
\r
@Override\r
public void onMultipartRequestMessage(MultipartRequestMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("MultipartRequest message received");\r
\r
}\r
\r
@Override\r
public void onPacketInMessage(PacketInMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("PacketIn message received");\r
\r
}\r
\r
@Override\r
public void onPortStatusMessage(PortStatusMessage notification) {\r
- // TODO Auto-generated method stub\r
+ LOGGER.debug("PortStatus message received");\r
\r
}\r
\r
- /* (non-Javadoc)\r
- * @see org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SystemNotificationsListener#onDisconnectEvent(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEvent)\r
- */\r
@Override\r
public void onDisconnectEvent(DisconnectEvent notification) {\r
LOGGER.debug("disconnection ocured: "+notification.getInfo());\r
/* Copyright (C)2013 Pantheon Technologies, s.r.o. All rights reserved. */\r
package org.opendaylight.openflowjava.protocol.impl.serialization.factories;\r
\r
+import java.util.ArrayList;\r
+\r
import io.netty.buffer.ByteBuf;\r
import io.netty.buffer.UnpooledByteBufAllocator;\r
-import junit.framework.Assert;\r
\r
+import org.junit.Assert;\r
import org.junit.Test;\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.factories.HelloMessageFactoryTest;\r
import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInput;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.SetConfigInputBuilder;\r
\r
+import com.google.common.collect.Lists;\r
+\r
/**\r
* @author timotej.kubas\r
* @author michal.polkorab\r
public void testSetConfigMessage() throws Exception {\r
SetConfigInputBuilder builder = new SetConfigInputBuilder();\r
BufferHelper.setupHeader(builder);\r
- builder.setFlags(SwitchConfigFlag.forValue(0));\r
+ ArrayList<SwitchConfigFlag> switchList = Lists.newArrayList(SwitchConfigFlag.forValue(0));\r
+ builder.setFlags(switchList);\r
builder.setMissSendLen(10);\r
SetConfigInput message = builder.build();\r
\r
factory.messageToBuffer(HelloMessageFactoryTest.VERSION_YET_SUPPORTED, out, message);\r
\r
BufferHelper.checkHeaderV13(out, MESSAGE_TYPE, MESSAGE_LENGTH);\r
- Assert.assertEquals("Wrong flags", message.getFlags().getIntValue(),SwitchConfigFlag.forValue(out.readUnsignedShort()).getIntValue());\r
+ Assert.assertArrayEquals("Wrong flags", message.getFlags().toArray(), switchList.toArray());\r
Assert.assertTrue("Wrong missSendLen", message.getMissSendLen() == out.readShort());\r
}\r
}\r