def instantiate_c2cInboundTransaction(loop, ip_addr, dst_id): import yaml, CETPSecurity, ConnectionTable, PolicyManager cesid = "cesb.lte." cetp_policies = "config_cesb/cetp_policies.json" filename = "config_cesb/config_cesb_ct.yaml" config_file = open(filename) ces_conf = yaml.load(config_file) ces_params = ces_conf['CESParameters'] conn_table = ConnectionTable.ConnectionTable() cetpstate_mgr = ConnectionTable.CETPStateTable( ) # Records the established CETP transactions (both H2H & C2C). Required for preventing the re-allocation already in-use SST & DST (in CETP transaction). cetp_security = CETPSecurity.CETPSecurity(loop, conn_table, ces_params) interfaces = PolicyManager.FakeInterfaceDefinition(cesid) policy_mgr = PolicyManager.PolicyManager( cesid, policy_file=cetp_policies ) # Shall ideally fetch the policies from Policy Management System (of Hassaan) - And will be called, policy_sys_agent host_register = PolicyManager.HostRegister() c2c_layer = MockCETPC2CLayer() remote_addr = ("10.0.3.101", 54432) cetp_mgr = MockCETPManager() c2c = iC2CTransaction(loop, r_addr=remote_addr, l_cesid=cesid, policy_mgr=policy_mgr, cetpstate_mgr=cetpstate_mgr, ces_params=ces_params, proto="tls", \ cetp_security=cetp_security, interfaces=interfaces, conn_table=conn_table, cetp_mgr=cetp_mgr) return c2c
def get_h2hLayer(loop): import yaml, CETPSecurity, ConnectionTable, PolicyManager cesid = "cesa.lte." r_cesid = "cesb.lte." cetp_policies = "config_cesa/cetp_policies.json" filename = "config_cesa/config_cesa_ct.yaml" config_file = open(filename) ces_conf = yaml.load(config_file) ces_params = ces_conf['CESParameters'] ces_params["max_c2c_transports"] = 2 conn_table = ConnectionTable.ConnectionTable() cetpstate_mgr = ConnectionTable.CETPStateTable() # Records the established CETP transactions (both H2H & C2C). Required for preventing the re-allocation already in-use SST & DST (in CETP transaction). cetp_security = CETPSecurity.CETPSecurity(loop, conn_table, ces_params) interfaces = PolicyManager.FakeInterfaceDefinition(cesid) policy_mgr = PolicyManager.PolicyManager(cesid, policy_file=cetp_policies) # Shall ideally fetch the policies from Policy Management System (of Hassaan) - And will be called, policy_sys_agent host_register = PolicyManager.HostRegister() #cetp_mgr = cetpManager.CETPManager(cetp_policies, cesid, ces_params, loop=loop) cetp_mgr = MockCETPManager() h = CETPH2H(l_cesid = cesid, r_cesid = r_cesid, cetpstate_mgr= cetpstate_mgr, policy_mgr=policy_mgr, policy_client=None, \ loop=loop, cetp_mgr=cetp_mgr, ces_params=ces_params, cetp_security=cetp_security, host_register=host_register, \ interfaces=interfaces, conn_table=conn_table) c2c = CETPC2C.CETPC2CLayer(loop, l_cesid=cesid, r_cesid=r_cesid, cetpstate_mgr= cetpstate_mgr, policy_mgr=policy_mgr, conn_table=conn_table, \ ces_params=ces_params, cetp_security=cetp_security, cetp_mgr=cetp_mgr, cetp_h2h=h, interfaces=interfaces) h.c2c = c2c return h
def instantiate_h2hOutboundTransaction(loop, ip_addr, dst_id): import yaml, CETPSecurity, ConnectionTable, PolicyManager cesid = "cesa.lte." cetp_policies = "config_cesa/cetp_policies.json" filename = "config_cesa/config_cesa_ct.yaml" config_file = open(filename) ces_conf = yaml.load(config_file) ces_params = ces_conf['CESParameters'] conn_table = ConnectionTable.ConnectionTable() cetpstate_mgr = ConnectionTable.CETPStateTable( ) # Records the established CETP transactions (both H2H & C2C). Required for preventing the re-allocation already in-use SST & DST (in CETP transaction). cetp_security = CETPSecurity.CETPSecurity(loop, conn_table, ces_params) interfaces = PolicyManager.FakeInterfaceDefinition(cesid) policy_mgr = PolicyManager.PolicyManager( cesid, policy_file=cetp_policies ) # Shall ideally fetch the policies from Policy Management System (of Hassaan) - And will be called, policy_sys_agent host_register = PolicyManager.HostRegister() h2h = H2HTransactionOutbound(loop=loop, cb=None, host_ip=ip_addr, src_id="", dst_id=dst_id, l_cesid="cesa.lte.", r_cesid="cesblte.", cetp_h2h=None, \ ces_params=ces_params, policy_mgr=policy_mgr, cetpstate_mgr=cetpstate_mgr, host_register=host_register, \ conn_table=conn_table, interfaces=interfaces, cetp_security=cetp_security) cb_args = ("SomeQ", ("10.0.3.111", 55443)) cb = (test_cb, cb_args) h2h.cb = cb return h2h
def __init__(self, cetp_host_policy_file, cesid, ces_params, hosttable, conn_table, pool_table, network, cetpstate_table, spm_services_boolean, host_policy_url, network_policy_url, cetp_network_policy_file, loop=None, name="CETPManager"): self._cetp_endpoints = { } # Dictionary of endpoints towards remote CES nodes. self._serverEndpoints = [ ] # List of server endpoint offering CETP listening service. self.c2c_register = {} self.cesid = cesid # Local ces-id self.ces_params = ces_params self.host_table = hosttable self.conn_table = conn_table self.pool_table = pool_table self.cetpstate_table = cetpstate_table # Records the established CETP transactions (both H2H & C2C). Required for preventing the re-allocation already in-use SST & DST (in CETP transaction). self.payloadID_table = CETP.PayloadIDTable() self.spm_services_boolean = spm_services_boolean self.cetp_security = CETPSecurity.CETPSecurity(loop, self.conn_table, ces_params) self.interfaces = PolicyManager.DPConfigurations(cesid, ces_params=ces_params) self._loop = loop self.network = network self._inbound_transports = { } # {'cesid': [transports]} - Temporary record of list of transports connected against a cesid self._load_cetp_params() self.name = name self._logger = logging.getLogger(name) self._logger.setLevel(LOGLEVEL_CETPManager) self._launch_policy_manager(cetp_host_policy_file, cetp_network_policy_file, network_policy_url, host_policy_url) self._initiate_local_cetp()
def instantiate_h2hInboundTransaction(sstag, dstag): import yaml, CETPSecurity, ConnectionTable, PolicyManager cesid = "cesb.lte." cetp_policies = "config_cesb/cetp_policies.json" filename = "config_cesb/config_cesb_ct.yaml" config_file = open(filename) ces_conf = yaml.load(config_file) ces_params = ces_conf['CESParameters'] conn_table = ConnectionTable.ConnectionTable() cetpstate_mgr = ConnectionTable.CETPStateTable( ) # Records the established CETP transactions (both H2H & C2C). Required for preventing the re-allocation already in-use SST & DST (in CETP transaction). cetp_security = CETPSecurity.CETPSecurity(loop, conn_table, ces_params) interfaces = PolicyManager.FakeInterfaceDefinition(cesid) policy_mgr = PolicyManager.PolicyManager( cesid, policy_file=cetp_policies ) # Shall ideally fetch the policies from Policy Management System (of Hassaan) - And will be called, policy_sys_agent host_register = PolicyManager.HostRegister() ih2h = H2HTransactionInbound(sstag=sstag, dstag=dstag, l_cesid=cesid, r_cesid="cesa.lte.", policy_mgr=policy_mgr, cetpstate_mgr=cetpstate_mgr, \ interfaces=interfaces, conn_table=conn_table, cetp_security=cetp_security, ces_params=ces_params) return ih2h