-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ip_prefix len based on proxy_arp status (#1046)
* Add ip_prefix len based on proxy_arp status and relevant test
- Loading branch information
Showing
5 changed files
with
176 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import sys | ||
import os | ||
import pytest | ||
from swsssdk import ConfigDBConnector | ||
|
||
test_path = os.path.dirname(os.path.abspath(__file__)) | ||
modules_path = os.path.dirname(test_path) | ||
scripts_path = os.path.join(modules_path, "scripts") | ||
sys.path.insert(0, modules_path) | ||
|
||
from imp import load_source | ||
load_source('neighbor_advertiser', scripts_path+'/neighbor_advertiser') | ||
import neighbor_advertiser | ||
|
||
class TestNeighborAdvertiser(object): | ||
@pytest.fixture | ||
def set_up(self): | ||
neighbor_advertiser.connect_config_db() | ||
neighbor_advertiser.connect_app_db() | ||
|
||
def test_neighbor_advertiser_slice(self, set_up): | ||
output = neighbor_advertiser.construct_neighbor_advertiser_slice() | ||
expected_output = dict({ | ||
'respondingSchemes': {'durationInSec': 300}, | ||
'switchInfo': {'ipv6Addr': '', 'hwSku': 'Mellanox-SN3800-D112C8', 'ipv4Addr': '', 'name': 'sonic-switch'}, | ||
'vlanInterfaces': [{ | ||
'ipv4AddrMappings': [ | ||
{'macAddr': '1d:34:db:16:a6:00', 'ipAddr': '192.168.0.1', 'ipPrefixLen': '32'} | ||
], | ||
'ipv6AddrMappings': [ | ||
{'macAddr': '1d:34:db:16:a6:00', 'ipAddr': 'fc02:1000::1', 'ipPrefixLen': '128'} | ||
], | ||
'vxlanId': u'1000', | ||
'vlanId': u'1000', | ||
'vxlanPort': '13550' | ||
}, | ||
{ | ||
'ipv4AddrMappings': [ | ||
{'macAddr': '1d:34:db:16:a6:00', 'ipAddr': '192.168.0.10', 'ipPrefixLen': '21'} | ||
], | ||
'ipv6AddrMappings': [ | ||
{'macAddr': '1d:34:db:16:a6:00', 'ipAddr': 'fc02:1011::1', 'ipPrefixLen': '64'} | ||
], | ||
'vxlanId': u'2000', | ||
'vlanId': u'2000', | ||
'vxlanPort': '13550' | ||
}] | ||
}) | ||
assert output == expected_output |
Oops, something went wrong.