summaryrefslogtreecommitdiffhomepage
path: root/test/scenario_test
diff options
context:
space:
mode:
authorNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-02-17 11:23:36 +0900
committerNaoto Hanaue <hanaue.naoto@po.ntts.co.jp>2015-02-17 11:23:36 +0900
commit43038c2e96e8ef7bcf2da145446fcd88c3007338 (patch)
tree97c0bd7e9033c215fa91b6f89baadf6973c4e32e /test/scenario_test
parenta777030609e49c2e77cb70352de579fa2ecc7be1 (diff)
scenario_test: add malformed test pattern
Diffstat (limited to 'test/scenario_test')
-rw-r--r--test/scenario_test/docker_control.py7
-rw-r--r--test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-AS_PATH_SEGMENT_LENGTH_INVALID.conf27
-rw-r--r--test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-NEXTHOP_LOOPBACK_ADDR_INVALID.conf22
-rw-r--r--test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-ORIGIN_TYPE_INVALID.conf26
-rw-r--r--test/scenario_test/route_server_ipv4_v6_test.py6
-rw-r--r--test/scenario_test/route_server_malformed_test.py13
-rw-r--r--test/scenario_test/route_server_test.py6
7 files changed, 95 insertions, 12 deletions
diff --git a/test/scenario_test/docker_control.py b/test/scenario_test/docker_control.py
index 1afab078..1b32314f 100644
--- a/test/scenario_test/docker_control.py
+++ b/test/scenario_test/docker_control.py
@@ -336,6 +336,9 @@ def make_config_append(quagga_num, go_path, bridge):
local(cmd, capture=True)
+def change_exagbp_version():
+ cmd = "docker exec exabgp git -C /root/exabgp pull origin master"
+ local(cmd, capture=True)
def reload_config():
@@ -474,8 +477,10 @@ def init_malformed_test_env_executor(conf_file, use_local):
make_startup_file()
change_owner_to_root(CONFIG_DIR)
+ change_exagbp_version()
+
start_gobgp()
- # time.sleep(5)
+
# run quagga docker container
docker_container_run_quagga(1, BRIDGE_0)
start_exabgp(conf_file)
diff --git a/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-AS_PATH_SEGMENT_LENGTH_INVALID.conf b/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-AS_PATH_SEGMENT_LENGTH_INVALID.conf
new file mode 100644
index 00000000..f78d9cb2
--- /dev/null
+++ b/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-AS_PATH_SEGMENT_LENGTH_INVALID.conf
@@ -0,0 +1,27 @@
+neighbor 10.0.255.1 {
+ router-id 192.168.0.7;
+ local-address 10.0.0.100;
+ local-as 65100;
+ peer-as 65000;
+ hold-time 90;
+ md5 "hoge100";
+ graceful-restart;
+
+ family {
+ inet unicast;
+ }
+ static {
+ route 10.7.0.14/32 {
+ next-hop 10.0.255.7;
+ # Malformed AS_PATH
+ # Send the attribute to the length and number of aspath is inconsistent
+ # Attribute Type 0x02 (AS_PATH)
+ # Attribute Flag 0x40 (well-known transitive)
+ # Attribute Value 0x02020000ffdc (
+ # segment type = 02
+ # segment length = 02 -> # correct value = 01
+ # as number = 65500 )
+ attribute [ 0x02 0x40 0x0202ffdc ];
+ }
+ }
+}
diff --git a/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-NEXTHOP_LOOPBACK_ADDR_INVALID.conf b/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-NEXTHOP_LOOPBACK_ADDR_INVALID.conf
new file mode 100644
index 00000000..f35415c1
--- /dev/null
+++ b/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-NEXTHOP_LOOPBACK_ADDR_INVALID.conf
@@ -0,0 +1,22 @@
+neighbor 10.0.255.1 {
+ router-id 192.168.0.7;
+ local-address 10.0.0.100;
+ local-as 65100;
+ peer-as 65000;
+ hold-time 90;
+ md5 "hoge100";
+ graceful-restart;
+
+
+ family {
+ inet unicast;
+ }
+ static {
+ route 10.7.0.14/32 {
+ # Malformed Invalid NEXT_HOP Attribute
+ # Send the attribute of invalid nexthop
+ # next-hop 127.0.0.1 -> # correct value = other than loopback and 0.0.0.0 address
+ next-hop 127.0.0.1;
+ }
+ }
+}
diff --git a/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-ORIGIN_TYPE_INVALID.conf b/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-ORIGIN_TYPE_INVALID.conf
new file mode 100644
index 00000000..6333ee94
--- /dev/null
+++ b/test/scenario_test/exabgp_test_conf/malformed1-exabgp-gobgp-v4-ORIGIN_TYPE_INVALID.conf
@@ -0,0 +1,26 @@
+neighbor 10.0.255.1 {
+ router-id 192.168.0.7;
+ local-address 10.0.0.100;
+ local-as 65100;
+ peer-as 65000;
+ hold-time 90;
+ md5 "hoge100";
+ graceful-restart;
+
+ family {
+ inet unicast;
+ }
+ static {
+ route 10.7.0.14/32 {
+ next-hop 10.0.255.7;
+ # Invalid ORIGIN Attribute
+ # Send the attribute of origin type 4
+ # Attribute Type 0x01 (Origin)
+ # Attribute Flag 0x40 (well-known transitive)
+ # Attribute Value 0x04 (
+ # origin type = 04 -> # correct value = 01 or 02 or 03 )
+
+ attribute [ 0x01 0x40 0x04 ];
+ }
+ }
+}
diff --git a/test/scenario_test/route_server_ipv4_v6_test.py b/test/scenario_test/route_server_ipv4_v6_test.py
index bff5bad5..361c1572 100644
--- a/test/scenario_test/route_server_ipv4_v6_test.py
+++ b/test/scenario_test/route_server_ipv4_v6_test.py
@@ -157,9 +157,9 @@ class GoBGPIPv6Test(unittest.TestCase):
self.assertEqual(exist_n, 1)
def retry_routine_for_stete(self, addresses):
- inprepar_quagga = True
+ in_prepare_quagga = True
retry_count = 0
- while inprepar_quagga:
+ while in_prepare_quagga:
if retry_count != 0:
print "please wait more (" + str(self.wait_per_retry) + " second)"
time.sleep(self.wait_per_retry)
@@ -183,7 +183,7 @@ class GoBGPIPv6Test(unittest.TestCase):
if address[0] == remote_ip and state == "BGP_FSM_ESTABLISHED":
success_count += 1
if success_count == len(addresses):
- inprepar_quagga = False
+ in_prepare_quagga = False
time.sleep(self.wait_per_retry)
def load_gobgp_config(self):
diff --git a/test/scenario_test/route_server_malformed_test.py b/test/scenario_test/route_server_malformed_test.py
index dba94c8d..addcc69a 100644
--- a/test/scenario_test/route_server_malformed_test.py
+++ b/test/scenario_test/route_server_malformed_test.py
@@ -51,6 +51,9 @@ def check_pattern():
pattern["malformed1-exabgp-gobgp-v4-NEXTHOP_INVALID.conf"] = "UPDATE message error / Attribute Flags Error / 0x600E08010110FFFFFF0000"
pattern["malformed1-exabgp-gobgp-v4-ROUTE_FAMILY_INVALID.conf"] = "UPDATE message error / Attribute Flags Error / 0x600E150002011020010DB800000000000000000000000100"
+ pattern["malformed1-exabgp-gobgp-v4-AS_PATH_SEGMENT_LENGTH_INVALID.conf"] = "UPDATE message error / Malformed AS_PATH / 0x4002040202FFDC"
+ pattern["malformed1-exabgp-gobgp-v4-NEXTHOP_LOOPBACK_ADDR_INVALID.conf"] = "UPDATE message error / Invalid NEXT_HOP Attribute / 0x4003047F000001"
+ pattern["malformed1-exabgp-gobgp-v4-ORIGIN_TYPE_INVALID.conf"] = "UPDATE message error / Invalid ORIGIN Attribute / 0x40010104"
return pattern
@@ -87,8 +90,8 @@ def test_malformed_packet():
def check_func(exabgp_conf, result):
- inprepar_quagga = True
- inprepar_exabgp = True
+ in_prepare_quagga = True
+ in_prepare_exabgp = True
retry_count = 0
# get neighbor addresses from gobgpd.conf
addresses = get_neighbor_address()
@@ -99,7 +102,7 @@ def check_func(exabgp_conf, result):
q_transitions = 0
q_state = ""
notification = ""
- while inprepar_quagga or inprepar_exabgp:
+ while in_prepare_quagga or in_prepare_exabgp:
if retry_count != 0:
print "please wait more (" + str(wait_per_retry) + " second)"
time.sleep(wait_per_retry)
@@ -122,7 +125,7 @@ def check_func(exabgp_conf, result):
q_transitions = neighbor['info']['fsm_established_transitions']
q_address = remote_ip
if q_state == "BGP_FSM_ESTABLISHED":
- inprepar_quagga = False
+ in_prepare_quagga = False
else:
e_address = remote_ip
# get notification message from exabgp log
@@ -131,7 +134,7 @@ def check_func(exabgp_conf, result):
if parse_msg is not None:
notification_src = parse_msg.group(0)[5:]
notification = notification_src[1:-1]
- inprepar_exabgp = False
+ in_prepare_exabgp = False
assert neighbors is not None, "neighbors is None"
assert len(neighbors) == len(addresses), "neighbors = " + len(neighbors) + ", addresses = " + len(addresses)
diff --git a/test/scenario_test/route_server_test.py b/test/scenario_test/route_server_test.py
index b093063e..03a27581 100644
--- a/test/scenario_test/route_server_test.py
+++ b/test/scenario_test/route_server_test.py
@@ -360,9 +360,9 @@ class GoBGPTest(unittest.TestCase):
self.retry_routine_for_bestpath(check_address, target_network, ans_nexthop)
def retry_routine_for_state(self, addresses, allow_state):
- inprepar_quagga = True
+ in_prepare_quagga = True
retry_count = 0
- while inprepar_quagga:
+ while in_prepare_quagga:
if retry_count != 0:
print "please wait more (" + str(self.wait_per_retry) + " second)"
time.sleep(self.wait_per_retry)
@@ -386,7 +386,7 @@ class GoBGPTest(unittest.TestCase):
if address == remote_ip and state == allow_state:
success_count += 1
if success_count == len(addresses):
- inprepar_quagga = False
+ in_prepare_quagga = False
time.sleep(self.wait_per_retry)
# load configration from gobgp(gobgpd.conf)