X-Git-Url: https://git.josue.xyz/?p=vsorcdistro%2F.git;a=blobdiff_plain;f=ryu%2Fbuild%2Flib.linux-armv7l-2.7%2Fryu%2Ftests%2Funit%2Flib%2Ftest_of_config_classes.py;fp=ryu%2Fbuild%2Flib.linux-armv7l-2.7%2Fryu%2Ftests%2Funit%2Flib%2Ftest_of_config_classes.py;h=5b0dd6d3fa68b7e0d03975912619abc2373e5a81;hp=0000000000000000000000000000000000000000;hb=f255202e7d913502500105433111a1d626eaabb6;hpb=002eb7cc64ee6697fc264b9ac5bc93eb33c7e213 diff --git a/ryu/build/lib.linux-armv7l-2.7/ryu/tests/unit/lib/test_of_config_classes.py b/ryu/build/lib.linux-armv7l-2.7/ryu/tests/unit/lib/test_of_config_classes.py new file mode 100644 index 0000000..5b0dd6d --- /dev/null +++ b/ryu/build/lib.linux-armv7l-2.7/ryu/tests/unit/lib/test_of_config_classes.py @@ -0,0 +1,442 @@ +# Copyright (C) 2014 Nippon Telegraph and Telephone Corporation. +# Copyright (C) 2014 YAMAMOTO Takashi +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import unittest +from nose.tools import eq_ +from nose.tools import ok_ + +import sys +import lxml.etree as ET +from formencode.doctest_xml_compare import xml_compare + +from ryu.lib.of_config import classes as ofc + + +GET = """ + CapableSwitch0 + + + LogicalSwitch9-Port4 + 4 + Port4 + 5000 + 5000 + + up + false + false + false + + + up + false + true + + + + 100Mb-FD + true + copper + unsupported + + + other + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + + + LogicalSwitch9-Port3 + 3 + Port3 + 5000 + 5000 + + up + false + false + false + + + up + false + true + + + + 100Mb-FD + true + copper + unsupported + + + other + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + + + LogicalSwitch7-Port2 + 2 + Port2 + 5000 + 5000 + + up + false + false + false + + + up + false + true + + + + 100Mb-FD + true + copper + unsupported + + + other + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + + + LogicalSwitch7-Port1 + 1 + Port1 + 5000 + 5000 + + up + false + false + false + + + up + false + true + + + + 100Mb-FD + true + copper + unsupported + + + other + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + 100Mb-FD + true + copper + unsupported + + + + + LogicalSwitch9-Port4-Queue992 + 992 + 4 + + 10 + 130 + + + + LogicalSwitch9-Port4-Queue991 + 991 + 4 + + 10 + 120 + + + + LogicalSwitch7-Port2-Queue994 + 994 + 2 + + 400 + 900 + + + + LogicalSwitch7-Port2-Queue993 + 993 + 2 + + 200 + 300 + + + + + + LogicalSwitch9 + + 0 + 255 + 16777216 + true + true + true + true + true + false + false + + all + controller + table + inport + any + + + all + select + indirect + fast-failover + + + select-weight + select-liveness + chaining + + + output + group + set-queue + set-mpls-ttl + dec-mpls-ttl + set-nw-ttl + dec-nw-ttl + copy-ttl-out + copy-ttl-in + push-vlan + pop-vlan + push-mpls + pop-mpls + push-pbb + pop-pbb + set-field + + + goto-table + write-metadata + write-actions + apply-actions + clear-actions + meter + + + 08:60:6E:7F:74:E7:00:09 + true + false + + failSecureMode + + + + Switch9-Controller + equal + 127.0.0.1 + 6633 + tcp + + down + 1.3 + + + + + LogicalSwitch9-Port4 + LogicalSwitch9-Port3 + LogicalSwitch9-Port4-Queue992 + LogicalSwitch9-Port4-Queue991 + + + + LogicalSwitch7 + + 0 + 255 + 16777216 + true + true + true + true + true + false + false + + all + controller + table + inport + any + + + all + select + indirect + fast-failover + + + select-weight + select-liveness + chaining + + + output + group + set-queue + set-mpls-ttl + dec-mpls-ttl + set-nw-ttl + dec-nw-ttl + copy-ttl-out + copy-ttl-in + push-vlan + pop-vlan + push-mpls + pop-mpls + set-field + + + goto-table + write-metadata + write-actions + apply-actions + clear-actions + + + 08:60:6E:7F:74:E7:00:07 + true + false + + failSecureMode + + + + Switch7-Controller + equal + 127.0.0.1 + 6633 + tcp + + down + 1.2 + + + + + LogicalSwitch7-Port2 + LogicalSwitch7-Port1 + LogicalSwitch7-Port2-Queue994 + LogicalSwitch7-Port2-Queue993 + + + + +""" + + +class Test_of_config_classes(unittest.TestCase): + """ Test case for ryu.lib.of_config.classes + """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def test_parse(self): + for xml0 in [GET]: + o = ofc.OFCapableSwitchType.from_xml(xml0) + xml1 = o.to_xml('capable-switch') + ok_(xml_compare(ET.fromstring(xml0), ET.fromstring(xml1), + reporter=sys.stderr.write)) + + def test_alt_names(self): + xml0 = GET + o = ofc.OFCapableSwitchType.from_xml(xml0) + eq_(o.logical_switches, getattr(o, 'logical_switches')) + eq_(o.logical_switches, getattr(o, 'logical-switches')) + + def test_iterate(self): + xml0 = GET + o = ofc.OFCapableSwitchType.from_xml(xml0) + for lsw in o.logical_switches.switch: + ok_(str(lsw.id).startswith('LogicalSwitch'))