summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Harbott <j.harbott@x-ion.de>2020-09-01 13:51:11 +0200
committerJens Harbott <j.harbott@x-ion.de>2020-09-01 13:51:11 +0200
commit9ffa0ac14e3e49c572b4f984620a0e16c15918d9 (patch)
tree80f4a2bef24bf23d1bed13f7670085e97c14b645
parent097106d8fb557e85a93c696a8d64579034708f39 (diff)
downloadpython-neutronclient-9ffa0ac14e3e49c572b4f984620a0e16c15918d9.tar.gz
Allow 4byte ASNs in dynamic routing client
Neutron-dynamic-routing has the bgp_4byte_asn extension which allows 4byte ASNs to be used, increasing the range of valid AS numbers. Since we cannot easily tell beforehand whether that extension is available, allow for the maximal interval to be used by clients and let the API validate the input. Change-Id: Ib4695272784b4a5ebbcb792cfec82dac3ef6f3cf
-rw-r--r--neutronclient/neutron/v2_0/bgp/speaker.py2
-rw-r--r--neutronclient/osc/v2/dynamic_routing/constants.py2
-rw-r--r--neutronclient/tests/unit/bgp/test_cli20_peer.py5
-rw-r--r--neutronclient/tests/unit/bgp/test_cli20_speaker.py5
4 files changed, 8 insertions, 6 deletions
diff --git a/neutronclient/neutron/v2_0/bgp/speaker.py b/neutronclient/neutron/v2_0/bgp/speaker.py
index c6533e2..6bdbd86 100644
--- a/neutronclient/neutron/v2_0/bgp/speaker.py
+++ b/neutronclient/neutron/v2_0/bgp/speaker.py
@@ -22,7 +22,7 @@ from neutronclient.neutron.v2_0.bgp import peer as bgp_peer
# Allowed BGP Autonomous number range
MIN_AS_NUM = 1
-MAX_AS_NUM = 65535
+MAX_AS_NUM = 4294967295
def get_network_id(client, id_or_name):
diff --git a/neutronclient/osc/v2/dynamic_routing/constants.py b/neutronclient/osc/v2/dynamic_routing/constants.py
index 0dd16b1..8885b42 100644
--- a/neutronclient/osc/v2/dynamic_routing/constants.py
+++ b/neutronclient/osc/v2/dynamic_routing/constants.py
@@ -15,4 +15,4 @@ BGP_SPEAKER = 'bgp_speaker'
BGP_PEERS = 'bgp_peers'
BGP_PEER = 'bgp_peer'
MIN_AS_NUM = 1
-MAX_AS_NUM = 65535
+MAX_AS_NUM = 4294967295
diff --git a/neutronclient/tests/unit/bgp/test_cli20_peer.py b/neutronclient/tests/unit/bgp/test_cli20_peer.py
index c89c21b..998b0d5 100644
--- a/neutronclient/tests/unit/bgp/test_cli20_peer.py
+++ b/neutronclient/tests/unit/bgp/test_cli20_peer.py
@@ -96,7 +96,7 @@ class CLITestV20BGPPeerJSON(test_cli20.CLITestV20Base):
name = 'my-name'
my_id = 'my-id'
peerip = '1.1.1.1'
- remote_asnum = '65536'
+ remote_asnum = '4294967296'
args = [name,
'--peer-ip', peerip,
'--remote-as', remote_asnum, ]
@@ -107,7 +107,8 @@ class CLITestV20BGPPeerJSON(test_cli20.CLITestV20Base):
self._test_create_resource,
resource, cmd, name, my_id, args,
position_names, position_values)
- self.assertEqual('remote-as "65536" should be an integer [%s:%s].' %
+ self.assertEqual('remote-as "4294967296" should be an '
+ 'integer [%s:%s].' %
(bgp_speaker.MIN_AS_NUM, bgp_speaker.MAX_AS_NUM),
str(exc))
diff --git a/neutronclient/tests/unit/bgp/test_cli20_speaker.py b/neutronclient/tests/unit/bgp/test_cli20_speaker.py
index 0d9cc60..5621576 100644
--- a/neutronclient/tests/unit/bgp/test_cli20_speaker.py
+++ b/neutronclient/tests/unit/bgp/test_cli20_speaker.py
@@ -108,7 +108,7 @@ class CLITestV20BGPSpeakerJSON(test_cli20.CLITestV20Base):
None)
name = 'my-name'
my_id = 'my-id'
- local_asnum = '65536'
+ local_asnum = '4294967296'
args = [name,
'--local-as', local_asnum]
position_names = ['name', 'local_as', ]
@@ -117,7 +117,8 @@ class CLITestV20BGPSpeakerJSON(test_cli20.CLITestV20Base):
self._test_create_resource,
resource, cmd, name, my_id, args,
position_names, position_values)
- self.assertEqual('local-as "65536" should be an integer [%s:%s].' %
+ self.assertEqual('local-as "4294967296" should be an '
+ 'integer [%s:%s].' %
(bgp_speaker.MIN_AS_NUM, bgp_speaker.MAX_AS_NUM),
str(exc))