def setUpClass(cls): # Start the mgmt-agent system test in background install_dir = os.environ.get("RIFT_INSTALL") demo_dir = os.path.join(install_dir, 'demos') testbed = os.path.join(demo_dir, 'mgmt_tbed.py') tmp_dir = install_dir + "/tmp" if not os.path.exists(tmp_dir): os.makedirs(tmp_dir) logfile = tmp_dir + "/logfile" cls.fd = open(logfile, "w") try: cls.sys_proc=Popen([testbed], stdin=DEVNULL, stdout=cls.fd, stderr=cls.fd, preexec_fn=os.setsid) except Exception as e: print("Failed to start system test.. error: {0}".format(e)) raise print("Started the Mgmt Agent Mini System Test..sleeping for {} secs".format(WAIT_TIME)) time.sleep(WAIT_TIME) # TODO: Validate whether everything has started. cls.mgmt_session=NetconfSession(cls.confd_host) cls.mgmt_session.connect() cls.model = RwYang.Model.create_libncx() cls.model.load_schema_ypbc(UtCompositeYang.get_schema())
def setUpClass(cls): # Start the mgmt-agent system test in background install_dir = os.environ.get("RIFT_INSTALL") demo_dir = os.path.join(install_dir, 'demos') testbed = os.path.join(demo_dir, 'mgmt_tbed.py') tmp_dir = install_dir + "/tmp" if not os.path.exists(tmp_dir): os.makedirs(tmp_dir) logfile = tmp_dir + "/logfile" cls.fd = open(logfile, "w") try: cls.sys_proc = Popen([testbed], stdin=DEVNULL, stdout=cls.fd, stderr=cls.fd, preexec_fn=os.setsid) except Exception as e: print("Failed to start system test.. error: {0}".format(e)) raise print("Started the Mgmt Agent Mini System Test..sleeping for {} secs". format(WAIT_TIME)) time.sleep(WAIT_TIME) # TODO: Validate whether everything has started. cls.mgmt_session = NetconfSession(cls.confd_host) cls.mgmt_session.connect() cls.model = RwYang.Model.create_libncx() cls.model.load_schema_ypbc(UtCompositeYang.get_schema())
def start(self): """ Entry point for the tasklet """ self.log.setLevel(logging.INFO) super().start() self._dts = rift.tasklets.DTS(self.tasklet_info, UtCompositeYang.get_schema(), self._loop, self.on_dts_state_change) # Set the instance id self.instance_name = self.tasklet_info.instance_name self.instance_id = int(self.instance_name.rsplit('-', 1)[1]) self.log.debug("Starting TestDriverTasklet Name: {}, Id: {}".format( self.instance_name, self.instance_id)) self.state = TaskletState.STARTING