4 # Copyright 2016 RIFT.IO Inc
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
28 from rift
.vcs
.ext
import ClassProperty
30 logger
= logging
.getLogger(__name__
)
33 class ConfigManagerTasklet(rift
.vcs
.core
.Tasklet
):
35 This class represents SO tasklet.
38 def __init__(self
, name
='rwcmtasklet', uid
=None):
40 Creates a PingTasklet object.
43 name - the name of the tasklet
44 uid - a unique identifier
46 super(ConfigManagerTasklet
, self
).__init
__(name
=name
, uid
=uid
)
48 plugin_directory
= ClassProperty('./usr/lib/rift/plugins/rwconmantasklet')
49 plugin_name
= ClassProperty('rwconmantasklet')
52 # Construct the system. This system consists of 1 cluster in 1
53 # colony. The master cluster houses CLI and management VMs
54 sysinfo
= rift
.vcs
.SystemInfo(
61 rift
.vcs
.VirtualMachine(
65 rift
.vcs
.uAgentTasklet(),
68 rift
.vcs
.CliTasklet(),
69 rift
.vcs
.DtsRouterTasklet(),
70 rift
.vcs
.MsgBrokerTasklet(),
71 rift
.vcs
.RestconfTasklet(),
72 ConfigManagerTasklet()
83 # Define the generic portmap.
87 # Define a mapping from the placeholder logical names to the real
88 # port names for each of the different modes supported by this demo.
97 # Define the connectivity between logical port names.
100 def main(argv
=sys
.argv
[1:]):
101 logging
.basicConfig(format
='%(asctime)-15s %(levelname)s %(message)s')
103 # Create a parser which includes all generic demo arguments
104 parser
= rift
.vcs
.demo
.DemoArgParser()
106 args
= parser
.parse_args(argv
)
108 #load demo info and create Demo object
109 demo
= rift
.vcs
.demo
.Demo(sysinfo
=sysinfo
,
111 port_names
=port_names
,
112 port_groups
=port_groups
)
114 # Create the prepared system from the demo
115 system
= rift
.vcs
.demo
.prepared_system_from_demo_and_args(demo
, args
, netconf_trace_override
=True)
117 # Start the prepared system
121 if __name__
== "__main__":
124 except rift
.vcs
.demo
.ReservationError
:
125 print("ERROR: unable to retrieve a list of IP addresses from the reservation system")
127 except rift
.vcs
.demo
.MissingModeError
:
128 print("ERROR: you need to provide a mode to run the script")
131 os
.system("stty sane")