Skip to content

Commit

Permalink
Merge pull request #382 from globocom/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
renanlopes97s committed May 29, 2023
2 parents ab81a0f + b46ddc0 commit eb27e1d
Show file tree
Hide file tree
Showing 11 changed files with 148 additions and 88 deletions.
4 changes: 2 additions & 2 deletions networkapi/api_neighbor/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def validate_neighbor_v4(self, user):
self.check_if_local_ip_vrf_is_the_same_as_remote_ip_vrf()
self.check_if_local_ip_and_local_asn_shares_at_least_one_equipment()
self.check_if_remote_ip_and_remote_asn_shares_at_least_one_equipment()
# self.check_if_peer_group_environments_has_local_ip_environment()
self.check_if_peer_group_environments_has_local_ip_environment()
self.check_if_neighbor_is_not_duplicated()

def check_if_neighbor_already_deployed(self):
Expand Down Expand Up @@ -673,7 +673,7 @@ def validate_neighbor_v6(self, user):
self.check_if_local_ip_vrf_is_the_same_as_remote_ip_vrf()
self.check_if_local_ip_and_local_asn_shares_at_least_one_equipment()
self.check_if_remote_ip_and_remote_asn_shares_at_least_one_equipment()
# self.check_if_peer_group_environments_has_local_ip_environment()
self.check_if_peer_group_environments_has_local_ip_environment()
self.check_if_neighbor_is_not_duplicated()

def check_if_neighbor_already_deployed(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@
},
"model": "api_peer_group.EnvironmentPeerGroup",
"pk": 2
},
{
"fields": {
"environment": 1,
"peer_group": 4
},
"model": "api_peer_group.EnvironmentPeerGroup",
"pk": 2
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"block6": "0000",
"block7": "0000",
"block8": "0003",
"networkipv6": 2
"networkipv6": 5
},
"model": "ip.ipv6",
"pk": 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,33 @@
},
"model": "ip.networkipv6",
"pk": 4
},
{
"fields": {
"active": true,
"ambient_vip": null,
"block": "64",
"block1": "fc00",
"block2": "0000",
"block3": "0000",
"block4": "0004",
"block5": "0000",
"block6": "0000",
"block7": "0000",
"block8": "0000",
"cluster_unit": "cluster-unit-1",
"mask1": "ffff",
"mask2": "ffff",
"mask3": "ffff",
"mask4": "ffff",
"mask5": "0000",
"mask6": "0000",
"mask7": "0000",
"mask8": "0000",
"network_type": 1,
"vlan": 5
},
"model": "ip.networkipv6",
"pk": 5
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,14 @@
},
"model": "api_peer_group.PeerGroup",
"pk": 3
},
{
"fields": {
"name": "peer_group_3",
"route_map_in": 5,
"route_map_out": 6
},
"model": "api_peer_group.PeerGroup",
"pk": 4
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,14 @@
},
"model": "vlan.vlan",
"pk": 4
},
{
"fields": {
"ambiente": 2,
"nome": "VLAN 5 of env 2",
"num_vlan": 5
},
"model": "vlan.vlan",
"pk": 5
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -203,26 +203,26 @@ def test_post_neighbor_v4_with_remotes_in_different_eqpts(self):
response.data['detail']
)

# def test_post_neighbor_v4_with_peer_group_envs_diff_local_ip_env(self):
# """Test POST NeighborV4 with different peer groups environments
# different than LocalIp Environment."""

# neighbor_v4_path = self.json_path. \
# format('neighbor_v4_with_peer_group_envs_'
# 'diff_than_local_ip_env.json')

# response = self.client.post(
# self.neighbor_v4_uri,
# data=self.load_json(neighbor_v4_path),
# content_type=self.content_type,
# HTTP_AUTHORIZATION=self.authorization)

# self.compare_status(400, response.status_code)
# self.compare_values(
# u'LocalIp id = 1 and PeerGroup id = 3 '
# u'belongs to different Environments',
# response.data['detail']
# )
def test_post_neighbor_v4_with_peer_group_envs_diff_local_ip_env(self):
"""Test POST NeighborV4 with different peer groups environments
different than LocalIp Environment."""

neighbor_v4_path = self.json_path. \
format('neighbor_v4_with_peer_group_envs_'
'diff_than_local_ip_env.json')

response = self.client.post(
self.neighbor_v4_uri,
data=self.load_json(neighbor_v4_path),
content_type=self.content_type,
HTTP_AUTHORIZATION=self.authorization)

self.compare_status(400, response.status_code)
self.compare_values(
u'LocalIp id = 9 and PeerGroup id = 4 '
u'belongs to different Environments',
response.data['detail']
)

def test_post_neighbor_v4_duplicated(self):
"""Test POST duplicated NeighborV4."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,26 +219,26 @@ def test_put_neighbor_v4_with_remotes_in_different_eqpts(self):
response.data['detail']
)

# def test_put_neighbor_v4_with_peer_group_envs_diff_local_ip_env(self):
# """Test PUT NeighborV4 with peer groups environments
# different than LocalIp Environment."""

# neighbor_v4_path = self.json_path. \
# format('neighbor_v4_with_peer_group_envs_'
# 'diff_than_local_ip_env.json')

# response = self.client.put(
# self.neighbor_v4_uri,
# data=self.load_json(neighbor_v4_path),
# content_type=self.content_type,
# HTTP_AUTHORIZATION=self.authorization)

# self.compare_status(400, response.status_code)
# self.compare_values(
# u'LocalIp id = 1 and PeerGroup id = 3 '
# u'belongs to different Environments',
# response.data['detail']
# )
def test_put_neighbor_v4_with_peer_group_envs_diff_local_ip_env(self):
"""Test PUT NeighborV4 with peer groups environments
different than LocalIp Environment."""

neighbor_v4_path = self.json_path. \
format('neighbor_v4_with_peer_group_envs_'
'diff_than_local_ip_env.json')

response = self.client.put(
self.neighbor_v4_uri,
data=self.load_json(neighbor_v4_path),
content_type=self.content_type,
HTTP_AUTHORIZATION=self.authorization)

self.compare_status(400, response.status_code)
self.compare_values(
u'LocalIp id = 1 and PeerGroup id = 3 '
u'belongs to different Environments',
response.data['detail']
)

def test_put_neighbor_v4_duplicated(self):
"""Test PUT duplicated NeighborV4."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
"neighbors": [
{
"id": 1,
"local_asn": 1,
"local_ip": 1,
"local_asn": 7,
"local_ip": 9,
"peer_group": 3,
"remote_asn": 2,
"remote_ip": 2,
"remote_asn": 1,
"remote_ip": 1,
"virtual_interface": "test_vi",
"next_hop_self": true,
"community": true,
"soft_reconfiguration": true,
"remove_private_as": true
"remove_private_as": true,
"kind": "1",
"description": "teste",
"password": "123",
"maximum_hops": "2",
"timer_keepalive": "12",
"timer_timeout": "128"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,26 +202,26 @@ def test_post_neighbor_v6_with_remotes_in_different_eqpts(self):
response.data['detail']
)

# def test_post_neighbor_v6_with_peer_group_envs_diff_local_ip_env(self):
# """Test POST NeighborV6 with peer groups environments
# different than LocalIp Environment."""

# neighbor_v6_path = self.json_path. \
# format('neighbor_v6_with_peer_group_envs_'
# 'diff_than_local_ip_env.json')

# response = self.client.post(
# self.neighbor_v6_uri,
# data=self.load_json(neighbor_v6_path),
# content_type=self.content_type,
# HTTP_AUTHORIZATION=self.authorization)

# self.compare_status(400, response.status_code)
# self.compare_values(
# u'LocalIp id = 1 and PeerGroup id = 3 '
# u'belongs to different Environments',
# response.data['detail']
# )
def test_post_neighbor_v6_with_peer_group_envs_diff_local_ip_env(self):
"""Test POST NeighborV6 with peer groups environments
different than LocalIp Environment."""

neighbor_v6_path = self.json_path. \
format('neighbor_v6_with_peer_group_envs_'
'diff_than_local_ip_env.json')

response = self.client.post(
self.neighbor_v6_uri,
data=self.load_json(neighbor_v6_path),
content_type=self.content_type,
HTTP_AUTHORIZATION=self.authorization)

self.compare_status(400, response.status_code)
self.compare_values(
u'LocalIp id = 1 and PeerGroup id = 3 '
u'belongs to different Environments',
response.data['detail']
)

def test_post_neighbor_v6_duplicated(self):
"""Test POST duplicated NeighborV6."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,26 +220,26 @@ def test_put_neighbor_v6_with_remotes_in_different_eqpts(self):
response.data['detail']
)

# def test_put_neighbor_v6_with_peer_group_envs_diff_local_ip_env(self):
# """Test PUT NeighborV6 with peer groups environments
# different than LocalIp Environment."""

# neighbor_v6_path = self.json_path. \
# format('neighbor_v6_with_peer_group_envs_'
# 'diff_than_local_ip_env.json')

# response = self.client.put(
# self.neighbor_v6_uri,
# data=self.load_json(neighbor_v6_path),
# content_type=self.content_type,
# HTTP_AUTHORIZATION=self.authorization)

# self.compare_status(400, response.status_code)
# self.compare_values(
# u'LocalIp id = 1 and PeerGroup id = 3 '
# u'belongs to different Environments',
# response.data['detail']
# )
def test_put_neighbor_v6_with_peer_group_envs_diff_local_ip_env(self):
"""Test PUT NeighborV6 with peer groups environments
different than LocalIp Environment."""

neighbor_v6_path = self.json_path. \
format('neighbor_v6_with_peer_group_envs_'
'diff_than_local_ip_env.json')

response = self.client.put(
self.neighbor_v6_uri,
data=self.load_json(neighbor_v6_path),
content_type=self.content_type,
HTTP_AUTHORIZATION=self.authorization)

self.compare_status(400, response.status_code)
self.compare_values(
u'LocalIp id = 9 and PeerGroup id = 3 '
u'belongs to different Environments',
response.data['detail']
)

def test_put_neighbor_v6_duplicated(self):
"""Test PUT duplicated NeighborV6."""
Expand Down

0 comments on commit eb27e1d

Please sign in to comment.