def __test_foo(): add_config_file('/etc/e3net/e3vswitch.ini') load_configs() logger = get_e3loger('e3vswitch') logger.info('hello world') logger.debug('hello debugging foo') logger1 = get_e3loger('e3vswitch1') logger1.info('hello world1')
def main(): import sys assert (len(sys.argv) == 2) add_config_file(sys.argv[1]) load_configs() e3neta_config_init() e3neta_db_init() from e3net.e3neta.e3neta_agent_ops import e3neta_agent_connect e3neta_agent_connect() grpc_server_init()
def main(): #initialize config as the 1st step add_config_file('/etc/e3net/e3vswitch-standalone.ini') load_configs() #initilize database options DB_NAME = 'E3NET_VSWITCH' init_database( DB_NAME, 'mysql+pymysql://e3net:e3credientials@localhost/E3NET_VSWITCH', False) load_database() #initialize inventory e3inventory_base_init() #initialize taskflow taskflow_init() #initialize event notification event_init() #initialize grpc grpc_server_init()
finally: self.guard.read_unlock() def get_stub(address, port, service_name, auto_create = True): channel = get_channel(address, port, auto_create) assert (channel) write_locked = False try: stub = _get_stub(channel, service_name) if not stub and auto_create: channel.guard.write_lock() write_locked = True assert (service_name in stub_inventory) stub = stub_inventory[service_name](channel.channel) channel.stubs[service_name] = stub channel.guard.write_unlock() write_locked = False stub = _get_stub(channel, service_name) if not stub: raise e3_exception(E3_EXCEPTION_NOT_FOUND) return stub finally: if write_locked: channel.guard.write_unlock() if __name__ == '__main__': from e3net.common.e3config import add_config_file from e3net.common.e3config import load_configs add_config_file('/etc/e3net/e3vswitch.ini') load_configs() print(get_stub('130.140.150.2',9418,'vswitch_host')) print(get_channel('130.140.150.2',9418))
process_null_topology(_iResult) synchronize_topology_label(_iResult) def generate_ether_service_apply_ops_taskflow(): lf = linear_flow.Flow(ETHER_SERVICE_TASKFLOW_APPLIANCE) lf.add(ether_service_taskflow_prefetch_service_elements()) return lf register_standalone_taskflow_category(ETHER_SERVICE_TASKFLOW_APPLIANCE, generate_ether_service_apply_ops_taskflow) if __name__ == '__main__': from e3net.common.e3standalone_taskflow import e3standalone_taskflow from e3net.common.e3standalone_taskflow import standalone_taskflow_init from e3net.common.e3config import add_config_file from e3net.common.e3config import load_configs from e3net.e3neta.e3neta_config import e3neta_config_init from e3net.e3neta.e3neta_db import e3neta_db_init from e3net.e3neta.e3neta_agent_ops import e3neta_agent_connect add_config_file('/etc/e3net/e3neta.ini.1') load_configs() e3neta_config_init() standalone_taskflow_init() e3neta_db_init() e3neta_agent_connect() spec = dict() spec['services'] = ['c642f944-1a73-4152-af1d-98f455e5c092'] tf = e3standalone_taskflow(ETHER_SERVICE_TASKFLOW_APPLIANCE, sync = False, store = {'config' : spec, 'iResult' : dict()}) tf.issue()