summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2013-12-27ofctl_v1_2/3: support IPv6Yuichi Ito
this patch implements the match conditions using IPv6. NOTE: OpenFlow1.0 does not support IPv6. e.g. using ofctl_rest) curl -X POST -d '{"dpid": 1, "match": {"eth_type": 34525, "ipv6_src": "fe08:2001::/64", "ipv6_dst": "ff02::1"}, "actions": [{"type": "OUTPUT", "port": 2}]}' http://localhost:8080/stats/flowentry/add Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
2013-12-27ofctl_v1_2/3: support OXM field namesYuichi Ito
this patch gets match field names to support OXM field names. NOTE: OpenFlow1.0 does not support OXM field names. the compatibility is as follows: dl_src eth_src dl_dst eth_dst dl_type eth_type dl_vlan vlan_vid nw_src ipv4_src nw_dst ipv4_dst nw_proto ip_proto tp_src tcp_src or udp_src tp_dst tcp_dst or udp_dst for example, the following commands for ofctl_rest install the same flow entry. curl -X POST -d '{"dpid": 1, "match": {"dl_type": 2048, "nw_src": "192.168.1.1"}, "actions": [{"type": "OUTPUT", "port": 2}]}' http://localhost:8080/stats/flowentry/add curl -X POST -d '{"dpid": 1, "match": {"eth_type": 2048, "ipv4_src": 192.168.1.1"}, "actions": [{"type": "OUTPUT", "port": 2}]}' http://localhost:8080/stats/flowentry/add Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
2013-12-27ofctl_rest: support OpenFlow1.2Yuichi Ito
this patch makes ofctl_rest enable use of OpenFlow1.2. Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com>
2013-12-25of_config_cli: remove no longer necessary "_pythonify" stuffYAMAMOTO Takashi
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25of_config: allows both of of-config element names and python style namesYAMAMOTO Takashi
for convenience of api consumers, allows both of of-config style element names (eg. logical-switches) and python style attribute names (eg. logical_switches). Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25of_config_cli: add add_queue commandYAMAMOTO Takashi
totally untested as i have no access to switches which support the operation. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25of_config_cli: add delete_config and copy_configYAMAMOTO Takashi
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25a simple of-config client commandYAMAMOTO Takashi
the placement (ryu/tests/bin) was suggested by FUJITA Tomonori. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25of_config.capable_switch: add delete_config and copy_configYAMAMOTO Takashi
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25tests.integrated.test_of_config: update after capable_switch api changeYAMAMOTO Takashi
Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25of_config.capable_switch: api tweakYAMAMOTO Takashi
tweak method to take of_config.classes classes instead of xml. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25add some convenient OF-Config classesYAMAMOTO Takashi
some python classes for a set of OF-Config 1.1.1 types. the goal is to allow programmers use OF-Config without direct XML manipulations. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25requires lxmlYAMAMOTO Takashi
will be used for OF-Config stuff. Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-25oxm_fields: make a crash less crypticYAMAMOTO Takashi
when oxm length is not what we expect, explicitly raise an exception with descriptive message like the following. Exception: Unexpected OXM payload length 3 for ipv6_flabel (expected 4) This often happens if you are using LINC and IPv6. https://github.com/FlowForwarding/of_protocol/pull/57 Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-24ofctl_v1_3: support OFPMeterConfigStatsYuichi Ito
Changes v2 -> v3: - correct the following description this patch implements a REST API for OFPMeterConfigStats. e.g., when you send a MeterMod message as: curl -X POST -d '{"dpid": 1, "meter_id": 1, "flags": "KBPS", "bands": [{"type": "DROP", "rate": 1000}, {"type": "REMARK", "rate": 2000}, {"type": "EXPERIMENTER", "rate": 3000} ]}' http://localhost:8080/stats/meterentry/add and you do the following command: curl http://localhost:8080/stats/meterconfig/1 then you will get the configuration as: {"1": [{"bands": [{"burst_size": 0, "rate": 1000, "type": "DROP"}, {"prec_level": 0, "burst_size": 0, "rate": 2000, "type": "REMARK"}, {"burst_size": 0, "rate": 3000, "experimenter": 0, "type": "EXPERIMENTER"}], "flags": "KBPS", "meter_id": 1}]} Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-24ofctl_v1_3: fix match for metadataSrini Seetharaman
also use the default priority for FlowMod. Signed-off-by: Srini Seetharaman <srini.seetharaman@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-20ofctl_v1_3: correct MeterStats and MeterFeaturesYuichi Ito
- add the insufficient handlers - correct the using instance Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-20topology: add of13 supportSrini Seetharaman
Signed-off-by: Srini Seetharaman <srini.seetharaman@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-20ofctl_v1_3: support meterYuichi Ito
Support meter in FlowMod instructions and support MeterMod, MeterStats, MeterFeatures. see following examples. FlowMod with the meter instruction: flow = {'match': {}, 'actions': [{'type': 'METER', 'meter_id': 1}] curl -X POST -d '{"dpid": 1, "match": {}, "actions": [{"type": "METER", "meter_id": 1}]}' http://localhost:8080/stats/flowentry/add MeterMod: meter = {'meter_id': 1, 'flags': 'KBPS', 'bands': [{'type': 'DROP', 'rate': 1000}]} curl -X POST -d '{"dpid": 1, "meter_id": 1, "flags": "KBPS", "bands": [{"type": "DROP", "rate": 1000}]}' http://localhost:8080/stats/meterentry/add NOTE: flags: 'KBPS', 'PKTPS', 'BURST', 'STATS' type: 'DROP', 'REMARK', 'EXPERIMENTER' MeterStats: curl http://localhost:8080/stats/meter/1 MetetFeatures: curl http://localhost:8080/stats/meterfeatures/1 Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-20ofctl_v1_3: support metadataYuichi Ito
Support metadata in FlowMod instructions and match. both a decimal number and a hexadecimal number are able to use in 'metadata' and 'metadata_mask'. all the following examples express the same flow entry. flow = {'match': {'metadata': '12345/4095'}, 'actions': [{'type': 'WRITE_METADATA', 'metadata': '12345', 'metadata_mask': '4095'}]} flow = {'match': {'metadata': '12345/4095'}, 'actions': [{'type': 'WRITE_METADATA', 'metadata': 12345, 'metadata_mask': 4095}]} flow = {'match': {'metadata': '0x3039/0xfff'}, 'actions': [{'type': 'WRITE_METADATA', 'metadata': '0x3039', 'metadata_mask': '0xfff'}]} Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-18packet.ospf: workaround a bytearray vs buffer problemYAMAMOTO Takashi
feeding bytearray to struct.unpack() crashes on some environment. (depends on the interpreter versions? i'm not sure.) this fixes the following crash in the unit test. the crash was seen on travis-ci, too. https://travis-ci.org/osrg/ryu/jobs/15578909 https://s3.amazonaws.com/archive.travis-ci.org/jobs/15578909/log.txt ====================================================================== ERROR: test_hello (packet.test_ospf.Test_ospf) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/yamamoto/git/ryu/ryu/tests/unit/packet/test_ospf.py", line 68, in test_hello msg2, cls, rest = ospf.OSPFMessage.parser(binmsg) File "/Users/yamamoto/git/ryu/ryu/lib/packet/ospf.py", line 443, in parser kwargs = subcls.parser(binmsg) File "/Users/yamamoto/git/ryu/ryu/lib/packet/ospf.py", line 501, in parser n = addrconv.ipv4.bin_to_text(n) File "/Users/yamamoto/git/ryu/ryu/lib/addrconv.py", line 30, in bin_to_text return str(self._addr(self._strat.packed_to_int(bin), File "/Users/yamamoto/git/ryu/.venv/lib/python2.7/site-packages/netaddr/strategy/ipv4.py", line 196, in packed_to_int return _struct.unpack('>I', packed_int)[0] error: unpack requires a string argument of length 4 ---------------------------------------------------------------------- Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-17rest_firewall: use the explicit max_len of flow_modYuichi Ito
rest_firewall had used the max_len value of flow_mod message which ofctl_v1_x specified. in response to change ofctl_v1_x, rest_firewall gets to use the specified max_len explicitly. Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-17lib: ofctl: support the specified max_len of flow_modYuichi Ito
this patch makes the max_len of flow_mod message more flexible. before applying this patch: ofctl_v1_0: 128 bytes for packet_in (fixed size) and none for others (fixed) ofctl_v1_2: 128 bytes for packet_in (fixed size) and 0 for others (fixed size) ofctl_v1_3: 0 for all by default (flexible) ofctl_v1_3 will send 0 byte length data in a packet_in message if max_len is not specified. after applying this patch: all version: MAX_LEN for all by default (flexible) NOTE: MAX_LEN is 65535 for OF1.0, and is OFPCML_MAX for OF1.2/1.3. max_len is omissible by every ofctl. Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-17packet lib: improve readability of jsonYuichi Ito
this patch makes some json members of several packet libraries human-readable. ex) ethernet.ethernet before applying this patch: {'ethernet': {'ethertype': 2048, 'dst': 'ZmY6ZmY6ZmY6ZmY6ZmY6ZmY=', 'src': 'MDA6MDA6MDA6MDA6MDA6MDA='}} after applying this patch: {'ethernet': {'ethertype': 2048, 'dst': u'ff:ff:ff:ff:ff:ff', 'src': u'00:00:00:00:00:00'}} Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13add license to ospf filesFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13test tool: add a script to make the test environment on mininetYuichi Ito
What this patch implements: This patch implements a script that provides the simple test environment that includes 2 switches and 2 links for the test tool as follows: +-----------+ +----------| target sw | The OpenFlow switch to be tested (Open vSwitch) | +-----------+ +------------+ (1) (2) | controller | | | +------------+ (1) (2) | +-----------+ +----------| tester sw | OpenFlow Switch (Open vSwitch) +-----------+ (X) : port number How to run: Do the following command: sudo ryu/tests/switch/run_mininet.py And then, run the test tool at another terminal: ryu-manager ryu/tests/switch/tester.py Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13test tool: add default test files (match)Yuichi Ito
What this patch implements: This patch implements the test files for the test tool. These test files aim to examine 'match' of FlowMod message. Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13test tool: add default test files (action with set-field only)Yuichi Ito
What this patch implements: This patch implements the test files for the test tool. These test files aim to examine 'set-field action' of FlowMod message. Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13test tool: add default test files (action without set-field)Yuichi Ito
What this patch implements: This patch implements the test files for the test tool. These test files aim to examine 'action' excluding 'set-field' of FlowMod message. Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13test tool: add OpenFlowSwitch test toolYuichi Ito
What this patch implements: This patch implements a tool which performs OpenFlow conformance testing. The tool can: - install various flow entries of OpenFlow 1.3 as follows: * all 'action' except SET_QUEUE and GROUP * all 'match' except IN_PHY_PORT - confirm whether the datapath works correctly according to the installed flow entries. Required test environment: The tool requires the test environment that includes 2 switches and 2 links as follows: +-----------+ +----------| target sw | The OpenFlow switch to be tested | +-----------+ +------------+ (1) (2) | controller | | | +------------+ (1) (2) | +-----------+ +----------| tester sw | OpenFlow Switch +-----------+ (X) : port number How does the tool work: The tool will: - install the flow entries into the target switch. - transmit a packet from the tester switch to the target switch. * According to the installed flow entries, the target switch outputs a packet towards the tester switch. * The tester switch sends a PacketIn message to the tool. - examine the packet that is included in the PacketIn message and output the result. * The tool supports also the table-miss examinations. The tool processes test files in the specified directory sequentially. By forming the result, you can create the list as: http://osrg.github.io/ryu-certification/switch/ovs.html http://osrg.github.io/ryu-certification/switch/LINC.html http://osrg.github.io/ryu-certification/switch/ofsoftswitch13.html Required test file format: [ "test name", { test pattern #01 }, { test pattern #02 }, ... ] Each test pattern has the following internal format: { "description": description of this test pattern, "prerequisite": [ FlowMod messages used by this test pattern ], "tests": [ "ingress": inbound packet data, "egress": outbound packet data, "PACKET-IN": packet data sent by PacketIn message, "table-miss": table id in which table-miss occurs ] } The extensions of the test files have to be '.json'. How to run: Do the following command: ryu-manager ryu/tests/switch/tester.py The following options can be used: - --test-switch-target (target sw dp-id) - --test-switch-tester (tester sw dp-id) - --test-switch-dir (test files directory) ex) ryu-manager --test-switch-target 0000000000000005 --test-switch-dir /home/ryu/tests ryu/tests/switch/tester.py Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13unit test for lib.packet.ospfishida wataru
Signed-off-by: Wataru ISHIDA <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13packet lib: add ospfishida wataru
Signed-off-by: Wataru ISHIDA <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-13lib/packet/packet_utils: Add a function to calculate fletcher checksumishida wataru
I'm resending the patches which appease pep8 fletcher checksum function for OSPF LSA checksum. refer to RFC1008. Signed-off-by: Wataru ISHIDA <ishida.wataru@lab.ntt.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: ipv6: correct a default parameter of opt_headerYuichi Ito
the length of opt_header has to be a multiple of 8. wrong: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | nxt | size | (opt)type=1 | (opt)len=6 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | (opt)data='\x00\x00\x00\x00\x00\x00' (6 octet) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ right: 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | nxt | size | (opt)type=1 | (opt)len=4 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | (opt)data='\x00\x00\x00\x00' (4 octet) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: add unittests for reversibility about jsonYuichi Ito
this patch adds tests that examine reversibility about json for all packet library. the test codes are written as: jsondict = msg1.to_jsondict() msg2 = cls.from_jsondict(jsondict['msg']) eq_(str(msg1), str(msg2)) TODO: make VRRP reversible. since VRRP has an unusual construction method, VRRP is not reversible about json. Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: slow: fix reversibility about jsonYuichi Ito
to_jsondict() JSON-izes public member variables of the object. from_jsondict() calls the constructor using JSON members as the arguments. LACP has the public member that is not required for the constructor, so TypeError occurs in from_jsondict(). this patch suppresses the output of to_jsondict() by changing unnecessary public members into protected members. examination code: from ryu.lib.packet import slow msg1 = slow.lacp() print msg1 jsondict = msg1.to_jsondict() msg2 = slow.lacp.from_jsondict(jsondict['lacp']) print msg2 print str(msg1) == str(msg2) before applying this patch: lacp(actor_key=0,actor_length=20,actor_port=0,actor_port_priority=0,actor_state=0,actor_state_activity=0,actor_state_aggregation=0,actor_state_collecting=0,actor_state_defaulted=0,actor_state_distributing=0,actor_state_expired=0,actor_state_synchronization=0,actor_state_timeout=0,actor_system='00:00:00:00:00:00',actor_system_priority=0,actor_tag=1,collector_length=16,collector_max_delay=0,collector_tag=3,partner_key=0,partner_length=20,partner_port=0,partner_port_priority=0,partner_state=0,partner_state_activity=0,partner_state_aggregation=0,partner_state_collecting=0,partner_state_defaulted=0,partner_state_distributing=0,partner_state_expired=0,partner_state_synchronization=0,partner_state_timeout=0,partner_system='00:00:00:00:00:00',partner_system_priority=0,partner_tag=2,subtype=1,terminator_length=0,terminator_tag=0,version=1) CLS <class 'ryu.lib.packet.slow.lacp'> ARG {'actor_state_distributing': 0, 'actor_length': 20, 'actor_system': 'MDA6MDA6MDA6MDA6MDA6MDA=', 'collector_max_delay': 0, 'terminator_length': 0, 'collector_length': 16, 'partner_state_synchronization': 0, 'partner_state_timeout': 0, 'partner_state_distributing': 0, 'partner_state_collecting': 0, 'actor_state_synchronization': 0, 'actor_state_expired': 0, 'actor_state_defaulted': 0, 'partner_state_expired': 0, 'partner_state': 0, 'partner_system_priority': 0, 'actor_state_aggregation': 0, 'version': 1, 'partner_port': 0, 'partner_length': 20, 'collector_tag': 3, 'partner_state_defaulted': 0, 'actor_state_timeout': 0, 'actor_port_priority': 0, 'partner_state_activity': 0, 'actor_state_activity': 0, 'terminator_tag': 0, 'actor_system_priority': 0, 'actor_key': 0, 'partner_system': 'MDA6MDA6MDA6MDA6MDA6MDA=', 'partner_tag': 2, 'actor_state': 0, 'actor_port': 0, 'partner_state_aggregation': 0, 'partner_port_priority': 0, 'actor_tag': 1, 'subtype': 1, 'partner_key': 0, 'actor_state _collecting': 0} KWARG {'actor_state_distributing': 0, 'actor_length': 20, 'actor_system': '00:00:00:00:00:00', 'collector_max_delay': 0, 'terminator_length': 0, 'collector_length': 16, 'partner_state_synchronization': 0, 'partner_state_timeout': 0, 'partner_state_distributing': 0, 'partner_state_collecting': 0, 'actor_state_synchronization': 0, 'actor_state_expired': 0, 'actor_state_defaulted': 0, 'partner_state_expired': 0, 'partner_state': 0, 'partner_system_priority': 0, 'actor_state_aggregation': 0, 'version': 1, 'partner_port': 0, 'partner_length': 20, 'collector_tag': 3, 'partner_state_defaulted': 0, 'actor_state_timeout': 0, 'actor_port_priority': 0, 'partner_state_activity': 0, 'actor_state_activity': 0, 'terminator_tag': 0, 'actor_system_priority': 0, 'actor_key': 0, 'partner_system': '00:00:00:00:00:00', 'partner_tag': 2, 'actor_state': 0, 'actor_port': 0, 'partner_state_aggregation': 0, 'partner_port_priority': 0, 'actor_tag': 1, 'subtype': 1, 'partner_key': 0, 'actor_state_collecting' : 0} Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 293, in from_jsondict return cls(**dict(kwargs, **additional_args)) TypeError: __init__() got an unexpected keyword argument 'actor_length' after applying this patch: lacp(actor_key=0,actor_port=0,actor_port_priority=0,actor_state_activity=0,actor_state_aggregation=0,actor_state_collecting=0,actor_state_defaulted=0,actor_state_distributing=0,actor_state_expired=0,actor_state_synchronization=0,actor_state_timeout=0,actor_system='00:00:00:00:00:00',actor_system_priority=0,collector_max_delay=0,partner_key=0,partner_port=0,partner_port_priority=0,partner_state_activity=0,partner_state_aggregation=0,partner_state_collecting=0,partner_state_defaulted=0,partner_state_distributing=0,partner_state_expired=0,partner_state_synchronization=0,partner_state_timeout=0,partner_system='00:00:00:00:00:00',partner_system_priority=0,version=1) lacp(actor_key=0,actor_port=0,actor_port_priority=0,actor_state_activity=0,actor_state_aggregation=0,actor_state_collecting=0,actor_state_defaulted=0,actor_state_distributing=0,actor_state_expired=0,actor_state_synchronization=0,actor_state_timeout=0,actor_system='00:00:00:00:00:00',actor_system_priority=0,collector_max_delay=0,partner_key=0,partner_port=0,partner_port_priority=0,partner_state_activity=0,partner_state_aggregation=0,partner_state_collecting=0,partner_state_defaulted=0,partner_state_distributing=0,partner_state_expired=0,partner_state_synchronization=0,partner_state_timeout=0,partner_system='00:00:00:00:00:00',partner_system_priority=0,version=1) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: sctp: fix reversibility about jsonYuichi Ito
although SCTP is using internal classes, no class is registered into '_class_prefixes'. therefore, AssertionError occurs in from_jsondict() when the argument 'param' was processed. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import sctp msg1 = sctp.sctp(chunks=[sctp.chunk_init(params=[sctp.param_cookie_preserve()])]) print msg1 jsondict = msg1.to_jsondict() msg2 = sctp.sctp.from_jsondict(jsondict['sctp']) print msg2 print str(msg1) == str(msg2) before applying this patch: sctp(chunks=[chunk_init(a_rwnd=0,flags=0,i_tsn=0,init_tag=0,length=0,mis=0,os=0,params=[param_cookie_preserve(length=0,value=0)])],csum=0,dst_port=0,src_port=0,vtag=0) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 291, in from_jsondict kwargs = cls._restore_args(_mapdict_kv(decode, dict_)) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 46, in <lambda> _mapdict_kv = lambda f, d: dict([(k, f(k, v)) for k, v in d.items()]) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 290, in <lambda> decode = lambda k, x: cls._decode_value(k, x, decode_string) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 234, in _decode_value return cls._get_decoder(k, decode_string)(json_value) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 242, in _decode v = map(_decode, json_value) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 245, in _decode v = cls.obj_from_jsondict(json_value) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 223, in obj_from_jsondict return obj_cls.from_jsondict(v) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 293, in from_jsondict return cls(**dict(kwargs, **additional_args)) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/sctp.py", line 273, in __init__ assert isinstance(one, param) AssertionError after applying this patch: sctp(chunks=[chunk_init(a_rwnd=0,flags=0,i_tsn=0,init_tag=0,length=0,mis=0,os=0,params=[param_cookie_preserve(length=0,value=0)])],csum=0,dst_port=0,src_port=0,vtag=0) sctp(chunks=[chunk_init(a_rwnd=0,flags=0,i_tsn=0,init_tag=0,length=0,mis=0,os=0,params=[param_cookie_preserve(length=0,value=0)])],csum=0,dst_port=0,src_port=0,vtag=0) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: lldp: fix reversibility about jsonYuichi Ito
although LLDP is using internal classes, no class is registered into '_class_prefixes'. therefore, from_jsondict() does not work correctly. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import lldp msg1 = lldp.lldp([lldp.ChassisID(subtype=lldp.ChassisID.SUB_MAC_ADDRESS, chassis_id='\x00\x00\x00\x00\x00\x00')]) print msg1 jsondict = msg1.to_jsondict() msg2 = lldp.lldp.from_jsondict(jsondict['lldp']) print msg2 print str(msg1) == str(msg2) before applying this patch: lldp(tlvs=[ChassisID(chassis_id='\x00\x00\x00\x00\x00\x00',len=7,subtype=4,typelen=519)]) lldp(tlvs=[{'ChassisID': {'subtype': 4, 'typelen': 519, 'chassis_id': '\x00\x00\x00\x00\x00\x00', 'len': 7}}]) False after applying this patch: lldp(tlvs=[ChassisID(chassis_id='\x00\x00\x00\x00\x00\x00',len=7,subtype=4,typelen=519)]) lldp(tlvs=[ChassisID(chassis_id='\x00\x00\x00\x00\x00\x00',len=7,subtype=4,typelen=519)]) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: llc: fix reversibility about jsonYuichi Ito
although LLDP is using internal classes, no class is registered into '_class_prefixes'. therefore, AssertionError occurs in from_jsondict() when the argument 'control' was processed. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import llc msg1 = llc.llc(dsap_addr=66, ssap_addr=66, control=llc.ControlFormatI()) print msg1 jsondict = msg1.to_jsondict() msg2 = llc.llc.from_jsondict(jsondict['llc']) print msg2 print str(msg1) == str(msg2) before applying this patch: llc(control=ControlFormatI(pf_bit=0,receive_sequence_number=0,send_sequence_number=0),dsap_addr=66,ssap_addr=66) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 293, in from_jsondict return cls(**dict(kwargs, **additional_args)) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/llc.py", line 140, in __init__ assert getattr(control, 'TYPE', None) in self._CTR_TYPES AssertionError after applying this patch: llc(control=ControlFormatI(pf_bit=0,receive_sequence_number=0,send_sequence_number=0),dsap_addr=66,ssap_addr=66) llc(control=ControlFormatI(pf_bit=0,receive_sequence_number=0,send_sequence_number=0),dsap_addr=66,ssap_addr=66) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: ipv6: fix reversibility about jsonYuichi Ito
although IPv6 is using internal classes, no class is registered into '_class_prefixes'. therefore, AssertionError occurs in from_jsondict() when the argument 'ext_hdrs' was processed. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import ipv6 msg1 = ipv6.ipv6(ext_hdrs=[ipv6.hop_opts()]) print msg1 jsondict = msg1.to_jsondict() msg2 = ipv6.ipv6.from_jsondict(jsondict['ipv6']) print msg2 print str(msg1) == str(msg2) before applying this patch: ipv6(dst='::',ext_hdrs=[hop_opts(data=None,nxt=6,size=0)],flow_label=0,hop_limit=255,nxt=6,payload_length=0,src='::',traffic_class=0,version=6) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 293, in from_jsondict return cls(**dict(kwargs, **additional_args)) File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/ipv6.py", line 86, in __init__ assert isinstance(ext_hdr, header) AssertionError after applying this patch: ipv6(dst='::',ext_hdrs=[hop_opts(data=None,nxt=6,size=0)],flow_label=0,hop_limit=255,nxt=6,payload_length=0,src='::',traffic_class=0,version=6) ipv6(dst='::',ext_hdrs=[hop_opts(data=None,nxt=6,size=0)],flow_label=0,hop_limit=255,nxt=6,payload_length=0,src='::',traffic_class=0,version=6) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: icmpv6: fix reversibility about jsonYuichi Ito
although ICMPv6 is using internal classes, no class is registered into '_class_prefixes'. therefore, from_jsondict() does not work correctly. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import icmpv6 msg1 = icmpv6.icmpv6(data=icmpv6.nd_neighbor()) print msg1 jsondict = msg1.to_jsondict() msg2 = icmpv6.icmpv6.from_jsondict(jsondict['icmpv6']) print msg2 print str(msg1) == str(msg2) before applying this patch: icmpv6(code=0,csum=0,data=nd_neighbor(dst='::',option=None,res=0),type_=0) icmpv6(code=0,csum=0,data={'nd_neighbor': {'res': 0, 'dst': '::', 'option': None}},type_=0) False after applying this patch: icmpv6(code=0,csum=0,data=nd_neighbor(dst='::',option=None,res=0),type_=0) icmpv6(code=0,csum=0,data=nd_neighbor(dst='::',option=None,res=0),type_=0) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: icmp: fix reversibility about jsonYuichi Ito
although ICMP is using internal classes, no class is registered into '_class_prefixes'. therefore, from_jsondict() does not work correctly. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import icmp msg1 = icmp.icmp(data=icmp.echo()) print msg1 jsondict = msg1.to_jsondict() msg2 = icmp.icmp.from_jsondict(jsondict['icmp']) print msg2 print str(msg1) == str(msg2) before applying this patch: icmp(code=0,csum=0,data=echo(data=None,id=0,seq=0),type=8) icmp(code=0,csum=0,data={'echo': {'data': None, 'id': 0, 'seq': 0}},type=8) False after applying this patch: icmp(code=0,csum=0,data=echo(data=None,id=0,seq=0),type=8) icmp(code=0,csum=0,data=echo(data=None,id=0,seq=0),type=8) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: dhcp: fix reversibility about jsonYuichi Ito
although DHCP is using internal classes, no class is registered into '_class_prefixes'. therefore, from_jsondict() does not work correctly. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import dhcp msg1 = dhcp.dhcp(op=dhcp.DHCP_BOOT_REQUEST, chaddr='00:00:00:00:00:00', options=dhcp.options()) print msg1 jsondict = msg1.to_jsondict() msg2 = dhcp.dhcp.from_jsondict(jsondict['dhcp']) print msg2 print str(msg1) == str(msg2) before applying this patch: dhcp(boot_file='',chaddr='00:00:00:00:00:00',ciaddr='0.0.0.0',flags=0,giaddr='0.0.0.0',hlen=17,hops=0,htype=1,op=1,options=options(magic_cookie='99.130.83.99',option_list=[],options_len=0),secs=0,siaddr='0.0.0.0',sname='',xid=2430470794,yiaddr='0.0.0.0') dhcp(boot_file='',chaddr='00:00:00:00:00:00',ciaddr='0.0.0.0',flags=0,giaddr='0.0.0.0',hlen=17,hops=0,htype=1,op=1,options={'options': {'option_list': [], 'magic_cookie': '99.130.83.99', 'options_len': 0}},secs=0,siaddr='0.0.0.0',sname='',xid=2430470794,yiaddr='0.0.0.0') False after applying this patch: dhcp(boot_file='',chaddr='00:00:00:00:00:00',ciaddr='0.0.0.0',flags=0,giaddr='0.0.0.0',hlen=17,hops=0,htype=1,op=1,options=options(magic_cookie='99.130.83.99',option_list=[],options_len=0),secs=0,siaddr='0.0.0.0',sname='',xid=1161619526,yiaddr='0.0.0.0') dhcp(boot_file='',chaddr='00:00:00:00:00:00',ciaddr='0.0.0.0',flags=0,giaddr='0.0.0.0',hlen=17,hops=0,htype=1,op=1,options=options(magic_cookie='99.130.83.99',option_list=[],options_len=0),secs=0,siaddr='0.0.0.0',sname='',xid=1161619526,yiaddr='0.0.0.0') True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: bpdu: fix reversibility about jsonYuichi Ito
to_jsondict() JSON-izes public member variables of the object. from_jsondict() calls the constructor using JSON members as the arguments. BPDU has the public member that is not required for the constructor, so TypeError occurs in from_jsondict(). this patch suppresses the output of to_jsondict() by changing unnecessary public members into protected members. examination code: from ryu.lib.packet import bpdu msg1 = bpdu.RstBPDUs() print msg1 jsondict = msg1.to_jsondict() msg2 = bpdu.RstBPDUs.from_jsondict(jsondict['RstBPDUs']) print msg2 print str(msg1) == str(msg2) before applying this patch: RstBPDUs(bpdu_type=2,bridge_mac_address='00:00:00:00:00:00',bridge_priority=32768,bridge_system_id_extension=0,flags=0,forward_delay=15,hello_time=2,max_age=20,message_age=0,port_number=0,port_priority=128,protocol_id=0,root_mac_address='00:00:00:00:00:00',root_path_cost=0,root_priority=32768,root_system_id_extension=0,version_1_length=0,version_id=2) CLS <class 'ryu.lib.packet.bpdu.RstBPDUs'> ARG {'max_age': 20, 'bpdu_type': 2, 'bridge_mac_address': 'MDA6MDA6MDA6MDA6MDA6MDA=', 'hello_time': 2, 'protocol_id': 0, 'bridge_priority': 32768, 'message_age': 0, 'version_id': 2, 'port_priority': 128, 'flags': 0, 'root_priority': 32768, 'version_1_length': 0, 'root_path_cost': 0, 'port_number': 0, 'root_mac_address': 'MDA6MDA6MDA6MDA6MDA6MDA=', 'root_system_id_extension': 0, 'forward_delay': 15, 'bridge_system_id_extension': 0} KWARG {'max_age': 20, 'bpdu_type': 2, 'bridge_mac_address': '00:00:00:00:00:00', 'hello_time': 2, 'protocol_id': 0, 'bridge_priority': 32768, 'message_age': 0, 'version_id': 2, 'port_priority': 128, 'flags': 0, 'root_priority': 32768, 'version_1_length': 0, 'root_path_cost': 0, 'port_number': 0, 'root_mac_address': '00:00:00:00:00:00', 'root_system_id_extension': 0, 'forward_delay': 15, 'bridge_system_id_extension': 0} Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/ryu/lib/stringify.py", line 293, in from_jsondict return cls(**dict(kwargs, **additional_args)) TypeError: __init__() got an unexpected keyword argument 'bpdu_type' after applying this patch: RstBPDUs(bridge_mac_address='00:00:00:00:00:00',bridge_priority=32768,bridge_system_id_extension=0,flags=0,forward_delay=15,hello_time=2,max_age=20,message_age=0,port_number=0,port_priority=128,root_mac_address='00:00:00:00:00:00',root_path_cost=0,root_priority=32768,root_system_id_extension=0) RstBPDUs(bridge_mac_address='00:00:00:00:00:00',bridge_priority=32768,bridge_system_id_extension=0,flags=0,forward_delay=15,hello_time=2,max_age=20,message_age=0,port_number=0,port_priority=128,root_mac_address='00:00:00:00:00:00',root_path_cost=0,root_priority=32768,root_system_id_extension=0) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: bgp: fix reversibility about jsonYuichi Ito
although BGP is using internal classes, no class is registered into '_class_prefixes'. therefore, from_jsondict() does not work correctly. this patch makes from_jsondict() to work correctly by registering internal classes into '_class_prefixes'. examination code: from ryu.lib.packet import bgp msg1 = bgp.BGPUpdate(withdrawn_routes=[bgp.BGPWithdrawnRoute(length=0, addr='192.168.0.1')]) print msg1 jsondict = msg1.to_jsondict() msg2 = bgp.BGPUpdate.from_jsondict(jsondict['BGPUpdate']) print msg2 print str(msg1) == str(msg2) before applying this patch: BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[BGPWithdrawnRoute(addr='192.168.0.1',length=0)],withdrawn_routes_len=None) BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[{'BGPWithdrawnRoute': {'length': 0, 'addr': '192.168.0.1'}}],withdrawn_routes_len=None) False after applying this patch: BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[BGPWithdrawnRoute(addr='192.168.0.1',length=0)],withdrawn_routes_len=None) BGPUpdate(len=None,marker='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff',nlri=[],path_attributes=[],total_path_attribute_len=None,type=2,withdrawn_routes=[BGPWithdrawnRoute(addr='192.168.0.1',length=0)],withdrawn_routes_len=None) True Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-12packet lib: packet_base: add a method which makes '_class_prefixes' easy to useYuichi Ito
the variable '_class_prefixes' of stringify.StringifyMixin is used to help the method 'from_jsondict()' to create the class instance. '_class_prefixes' requires a list of the class names. some classes have another list of the class names already. this patch adds a method which makes '_class_prefixes' by using the existing list. before applying this patch: (e.g. ryu.lib.packet.ipv6) # append the name to another list @ipv6.register_header_type(inet.IPPROTO_HOPOPTS) class hop_opts(opt_header): ... @ipv6.register_header_type(inet.IPPROTO_DSTOPTS) class dst_opts(opt_header): .... # append the name again ipv6._class_prefixes = ['hop_opts', 'dst_opts', ...] after applying this patch: (e.g. ryu.lib.packet.ipv6) # append the name to another list @ipv6.register_header_type(inet.IPPROTO_HOPOPTS) class hop_opts(opt_header): ... @ipv6.register_header_type(inet.IPPROTO_DSTOPTS) class dst_opts(opt_header): .... # create the new list from another list ipv6.set_classes(ipv6._IPV6_EXT_HEADER_TYPE) Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-11stplib: support OF 1.2/1.3watanabe.fumitaka
ryu/lib/stplib.py : Support OpenFlow 1.2/1.3 ryu/app/simple_switch_stp.py : Correspondence to parameter change of stplib.EventPortStateChange Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-07stplib: Reduction of the number of threadswatanabe.fumitaka
The number of threads was reduced for the simplification of processing. There was three sending BPDU threads before. - send Config BPDU thread - send TopologyChange BPDU thread - send TopologyChangeNotification BPDU thread They were unified to one thread. - send BPDU thread Signed-off-by: WATANABE Fumitaka <watanabe.fumitaka@nttcom.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-05add OpenFlow 1.4 definitionsFUJITA Tomonori
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
2013-12-04packet lib: igmp: support default parametersYuichi Ito
Signed-off-by: Yuichi Ito <ito.yuichi0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>