test_controller: Test cases for _split_addr()
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
09d5b2533c
commit
7ef14a83a2
@ -24,9 +24,11 @@ import json
|
||||
import os
|
||||
import sys
|
||||
import warnings
|
||||
import unittest
|
||||
import logging
|
||||
import random
|
||||
import unittest
|
||||
|
||||
from nose.tools import eq_, raises
|
||||
|
||||
from ryu.base import app_manager # To suppress cyclic import
|
||||
from ryu.controller import controller
|
||||
@ -39,6 +41,38 @@ from ryu.ofproto import ofproto_v1_0_parser
|
||||
LOG = logging.getLogger('test_controller')
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
"""
|
||||
Test cases for utilities defined in controller module.
|
||||
"""
|
||||
|
||||
def test_split_addr_with_ipv4(self):
|
||||
addr, port = controller._split_addr('127.0.0.1:6653')
|
||||
eq_('127.0.0.1', addr)
|
||||
eq_(6653, port)
|
||||
|
||||
def test_split_addr_with_ipv6(self):
|
||||
addr, port = controller._split_addr('[::1]:6653')
|
||||
eq_('::1', addr)
|
||||
eq_(6653, port)
|
||||
|
||||
@raises(ValueError)
|
||||
def test_split_addr_with_invalid_addr(self):
|
||||
controller._split_addr('127.0.0.1')
|
||||
|
||||
@raises(ValueError)
|
||||
def test_split_addr_with_invalid_ipv4_addr(self):
|
||||
controller._split_addr('xxx.xxx.xxx.xxx:6653')
|
||||
|
||||
@raises(ValueError)
|
||||
def test_split_addr_with_invalid_ipv6_addr(self):
|
||||
controller._split_addr('[::xxxx]:6653')
|
||||
|
||||
@raises(ValueError)
|
||||
def test_split_addr_with_non_bracketed_ipv6_addr(self):
|
||||
controller._split_addr('::1:6653')
|
||||
|
||||
|
||||
class Test_Datapath(unittest.TestCase):
|
||||
"""
|
||||
Test cases for controller.Datapath
|
||||
|
Loading…
x
Reference in New Issue
Block a user