blob: bf3cc20449dd5266deef3c9fa7870d752a0b9a17 [file] [log] [blame]
stevenvanrossem8eac3cc2017-01-30 13:14:27 +01001"""
2Copyright (c) 2015 SONATA-NFV
3ALL RIGHTS RESERVED.
4
5Licensed under the Apache License, Version 2.0 (the "License");
6you may not use this file except in compliance with the License.
7You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11Unless required by applicable law or agreed to in writing, software
12distributed under the License is distributed on an "AS IS" BASIS,
13WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14See the License for the specific language governing permissions and
15limitations under the License.
16
17Neither the name of the SONATA-NFV [, ANY ADDITIONAL AFFILIATION]
18nor the names of its contributors may be used to endorse or promote
19products derived from this software without specific prior written
20permission.
21
22This work has been performed in the framework of the SONATA project,
23funded by the European Commission under Grant number 671517 through
24the Horizon 2020 and 5G-PPP programmes. The authors would like to
25acknowledge the contributions of their colleagues of the SONATA
26partner consortium (www.sonata-nfv.eu).
27"""
28"""
29A simple topology with two PoPs for the y1 demo story board.
30
31 (dc1) <<-->> s1 <<-->> (dc2)
32
33- SAP deployment enabled
34- learning switch enabled
35"""
36
37import logging
38from mininet.log import setLogLevel
39from emuvim.dcemulator.net import DCNetwork
40from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint
41from emuvim.api.sonata import SonataDummyGatekeeperEndpoint
42from mininet.node import RemoteController
stevenvanrossemc6ace2d2017-04-21 13:47:06 +020043import os
stevenvanrossem8eac3cc2017-01-30 13:14:27 +010044
45logging.basicConfig(level=logging.INFO)
46
47
48def create_topology1():
49 # create topology
stevenvanrossemc6ace2d2017-04-21 13:47:06 +020050 net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=True)
stevenvanrossem8eac3cc2017-01-30 13:14:27 +010051 dc1 = net.addDatacenter("dc1")
52
53
54 # add the command line interface endpoint to each DC (REST API)
55 rapi1 = RestApiEndpoint("0.0.0.0", 5001)
56 rapi1.connectDCNetwork(net)
57 rapi1.connectDatacenter(dc1)
58 # run API endpoint server (in another thread, don't block)
59 rapi1.start()
60
stevenvanrossemc6ace2d2017-04-21 13:47:06 +020061
62 # specify a vnfd file to be deployed as internal SAP:
63 sap_vnfd = 'vepc_sap_vnfd.yml'
64 dir_path = os.path.dirname(__file__)
65 sap_vnfd_path = os.path.join(dir_path, sap_vnfd)
66 # sap_vnfd_path = None
stevenvanrossem8eac3cc2017-01-30 13:14:27 +010067 # add the SONATA dummy gatekeeper to each DC
stevenvanrossemc6ace2d2017-04-21 13:47:06 +020068 sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True,
69 docker_management=True, auto_delete=True,
70 sap_vnfd_path=sap_vnfd_path)
stevenvanrossem8eac3cc2017-01-30 13:14:27 +010071 sdkg1.connectDatacenter(dc1)
72 # run the dummy gatekeeper (in another thread, don't block)
73 sdkg1.start()
74
75 # start the emulation platform
76 net.start()
77 net.CLI()
78 net.stop()
79
80
81def main():
82 setLogLevel('info') # set Mininet loglevel
83 create_topology1()
84
85
86if __name__ == '__main__':
87 main()