1 # Copyright (c) 2018 SONATA-NFV, 5GTANGO and Paderborn University
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Neither the name of the SONATA-NFV, 5GTANGO, Paderborn University
17 # nor the names of its contributors may be used to endorse or promote
18 # products derived from this software without specific prior written
21 # This work has also been performed in the framework of the 5GTANGO project,
22 # funded by the European Commission under Grant number 761493 through
23 # the Horizon 2020 and 5G-PPP programmes. The authors would like to
24 # acknowledge the contributions of their colleagues of the 5GTANGO
25 # partner consortium (www.5gtango.eu).
27 from mininet
.log
import setLogLevel
28 from emuvim
.dcemulator
.net
import DCNetwork
29 from emuvim
.api
.rest
.rest_api_endpoint
import RestApiEndpoint
30 from emuvim
.api
.tango
import TangoLLCMEndpoint
32 logging
.basicConfig(level
=logging
.DEBUG
)
33 setLogLevel('info') # set Mininet loglevel
34 logging
.getLogger('werkzeug').setLevel(logging
.DEBUG
)
35 logging
.getLogger('5gtango.llcm').setLevel(logging
.DEBUG
)
38 def create_topology():
39 net
= DCNetwork(monitor
=False, enable_learning
=True)
40 # create two data centers
41 dc1
= net
.addDatacenter("dc1")
42 dc2
= net
.addDatacenter("dc2")
43 # interconnect data centers
44 net
.addLink(dc1
, dc2
, delay
="20ms")
45 # add the command line interface endpoint to the emulated DC (REST API)
46 rapi1
= RestApiEndpoint("0.0.0.0", 5001)
47 rapi1
.connectDCNetwork(net
)
48 rapi1
.connectDatacenter(dc1
)
49 rapi1
.connectDatacenter(dc2
)
51 # add the 5GTANGO lightweight life cycle manager (LLCM) to the topology
52 llcm1
= TangoLLCMEndpoint("0.0.0.0", 5000, deploy_sap
=False)
53 llcm1
.connectDatacenter(dc1
)
54 llcm1
.connectDatacenter(dc2
)
55 # run the dummy gatekeeper (in another thread, don't block)
57 # start the emulation and enter interactive CLI
60 # when the user types exit in the CLI, we stop the emulator
68 if __name__
== '__main__':