Skip to content

Commit

Permalink
Added location testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Baldin committed Jul 20, 2021
1 parent d00b109 commit f8d0c30
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
12 changes: 11 additions & 1 deletion test/sliver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from fim.slivers.network_link import NetworkLinkSliver
from fim.slivers.network_service import NetworkServiceSliver, NetworkServiceInfo
from fim.slivers.path_info import ERO, PathInfo, Path
from fim.slivers.capacities_labels import Capacities, Labels, CapacityHints
from fim.slivers.capacities_labels import Capacities, Labels, CapacityHints, Location


class TestSlivers(unittest.TestCase):
Expand Down Expand Up @@ -70,4 +70,14 @@ def testCapacitiesLabels(self):
assert(ns.get_labels().vlan_range == '1-4096')
assert(ns.get_capacities().core == 2)

def testLocation(self):
ns = NodeSliver()
loc = Location(postal='100 Europa Dr., Chapel Hill, NC 27517')
assert(loc.postal is not None)
ns.set_properties(location=loc)
loc1 = ns.get_property('location')
lat, lon = loc1.to_latlon()
self.assertGreater(lat, 35.00)
self.assertLess(lon, -79.00)
#print(f'{lat=} {lon=}')

21 changes: 12 additions & 9 deletions test/substrate_topology_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def tearDown(self) -> None:
def testRENCSiteAd(self):
# create a site advertisement
site = 'RENC'
loc = f.Location(postal='100 Europa Dr., Chapel Hill, NC 27517')
head_model = 'R7515'
worker_model = 'R7525'
hn_cap = f.Capacities()
Expand All @@ -36,18 +37,18 @@ def testRENCSiteAd(self):
#

gpuw = self.topo.add_node(name='renc-w1',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='HX6VQ53',
ntype=f.NodeType.Server,
capacities=gpu_worker_cap)

fnw = self.topo.add_node(name='renc-w2',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='HX7LQ53',
ntype=f.NodeType.Server,
capacities=network_worker_cap)
snw = self.topo.add_node(name='renc-w3',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='HX7KQ53',
ntype=f.NodeType.Server,
capacities=network_worker_cap)
Expand Down Expand Up @@ -336,6 +337,7 @@ def testRENCSiteAd(self):
def testUKYSiteAd(self):
# create a site advertisement
site = 'UKY'
loc = f.Location(postal='301 Hilltop Ave Lexington, KY 40506')
head_model = 'R7515'
worker_model = 'R7525'
hn_cap = f.Capacities()
Expand All @@ -355,15 +357,15 @@ def testUKYSiteAd(self):
#

gpuw = self.topo.add_node(name='uky-w1',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='3JB2R53',
ntype=f.NodeType.Server, capacities=gpu_worker_cap)
fnw = self.topo.add_node(name='uky-w2',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='3JB0R53',
ntype=f.NodeType.Server, capacities=network_worker_cap)
snw = self.topo.add_node(name='uky-w3',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='3JB1R53',
ntype=f.NodeType.Server, capacities=network_worker_cap)

Expand Down Expand Up @@ -654,6 +656,7 @@ def testUKYSiteAd(self):
def testLBNLSiteAd(self):
# create a site advertisement
site = 'LBNL'
loc = f.Location(postal='1 Cyclotron Rd, Berkeley, CA 94720')
head_model = 'R7515'
worker_model = 'R7525'
hn_cap = f.Capacities()
Expand All @@ -673,15 +676,15 @@ def testLBNLSiteAd(self):
#

gpuw = self.topo.add_node(name='lbnl-w1',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='5B3BR53',
ntype=f.NodeType.Server, capacities=gpu_worker_cap)
fnw = self.topo.add_node(name='lbnl-w2',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='5B38R53',
ntype=f.NodeType.Server, capacities=network_worker_cap)
snw = self.topo.add_node(name='lbnl-w3',
model=worker_model, site=site,
model=worker_model, site=site, location=loc,
node_id='5B39R53',
ntype=f.NodeType.Server, capacities=network_worker_cap)

Expand Down

0 comments on commit f8d0c30

Please sign in to comment.