From: peusterm Date: Wed, 31 Aug 2016 17:00:17 +0000 (+0200) Subject: Added round robin based placement algorithm to dummy GK to use both PoPs for the... X-Git-Tag: v3.1~61^2~1 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=f64595435d6ddca28f68ed88410c2fa49cbcfe1a;p=osm%2Fvim-emu.git Added round robin based placement algorithm to dummy GK to use both PoPs for the deployment --- diff --git a/src/emuvim/api/sonata/dummygatekeeper.py b/src/emuvim/api/sonata/dummygatekeeper.py index 766ec73..69e5f3c 100755 --- a/src/emuvim/api/sonata/dummygatekeeper.py +++ b/src/emuvim/api/sonata/dummygatekeeper.py @@ -164,7 +164,8 @@ class Service(object): # 3. compute placement of this service instance (adds DC names to VNFDs) if not GK_STANDALONE_MODE: - self._calculate_placement(FirstDcPlacement) + #self._calculate_placement(FirstDcPlacement) + self._calculate_placement(RoundRobinDcPlacement) # iterate over all vnfds that we have to start for vnfd in self.vnfds.itervalues(): vnfi = None @@ -502,6 +503,21 @@ class FirstDcPlacement(object): vnfd["dc"] = list(dcs.itervalues())[0] +class RoundRobinDcPlacement(object): + """ + Placement: Distribute VNFs across all available DCs in a round robin fashion. + """ + + def place(self, nsd, vnfds, dcs): + c = 0 + dcs_list = list(dcs.itervalues()) + for name, vnfd in vnfds.iteritems(): + vnfd["dc"] = dcs_list[c % len(dcs_list)] + c += 1 # inc. c to use next DC + + + + """ Resource definitions and API endpoints """