本文整理汇总了Python中tn_rm_delegate.logger.info函数的典型用法代码示例。如果您正苦于以下问题:Python info函数的具体用法?Python info怎么用?Python info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了info函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: find_dev
def find_dev(self, src_if, dst_if):
urlbase = src_if.ryu_url
dpid = src_if.dpid
params = {}
params["ovsdb"] = src_if.ovsdb
if (src_if.gtype == "ovsgre"):
params["type"] = "gre"
else:
raise ManagerException("OvsManager:find_dev",
"Type (%s) is unknown, must be \"ovsgre\"." % (src_if.gtype))
params["local_ip"] = src_if.address
params["remote_ip"] = dst_if.address
logger.info("search gre link. url=%s, dpid=%s, ovsdb=%s, type=%s, local=%s, remote=%s" % (urlbase, dpid, params["ovsdb"], params["type"], params["local_ip"], params["remote_ip"]));
finds = ovsif.get_tunnel_info(urlbase, dpid, params)
if len(finds) == 0:
return (None, None)
elif len(finds) == 1:
for p in finds.keys():
logger.info("find gre link. dev=%s, ofport=%s" % (p, finds[p]))
return (p, finds[p])
else:
raise ManagerException("OvsManager:init", "Duplicate path is exist. %s" % finds)
开发者ID:dana-i2cat,项目名称:felix,代码行数:25,代码来源:ovsgre.py
示例2: add_rule
def add_rule(self, interface, sevlan, ofvlan):
urlbase = interface.ryu_url
dpid = interface.dpid
ofdev, ofport = interface.get_of(self.ovs_id)
params = {}
params["dpid"] = int(dpid, 16)
params["priority"] = OF_PRIORITY
params["idel_timeout"] = OF_TIMEOUT
params["hard_timeout"] = OF_TIMEOUT
params["cookie"] = OF_COOKIE
params["cookie_mask"] = OF_COOKIE_MASK
params["table_id"] = OF_TABLE_ID
params["flags"] = OF_FLAGS
matchs = {"in_port": interface.seport, "dl_vlan": sevlan}
params["match"] = matchs
# actions = [{"type":"SET_VLAN_VID", "vlan_vid": ofvlan}, {"type":"OUTPUT", "port": interface.ofport}]
actions = [{"type":"SET_VLAN_VID", "vlan_vid": ofvlan}, {"type":"OUTPUT", "port": ofport}]
params["actions"] = actions
rc = ovsif.add_flow(urlbase, params)
logger.info("add_rule: ret=%s" % rc)
# matchs = {"in_port": interface.ofport, "dl_vlan": ofvlan}
matchs = {"in_port": ofport, "dl_vlan": ofvlan}
params["match"] = matchs
actions = [{"type":"SET_VLAN_VID", "vlan_vid": sevlan}, {"type":"OUTPUT", "port": interface.seport}]
params["actions"] = actions
rc = ovsif.add_flow(urlbase, params)
logger.info("add_rule: ret=%s" % rc)
开发者ID:dana-i2cat,项目名称:felix,代码行数:30,代码来源:ovsgre.py
示例3: teardown_tunnel
def teardown_tunnel(self, src_if, dst_if):
sw = get_swManager(src_if)
ofport = None
try:
# ofport = sw.get_port(src_if.ofdev)
ofdev, ofport = src_if.get_of(self.ovs_id)
ofport2 = sw.get_port(ofdev)
if ofport != ofport2:
logger.error("teardown_tunnel:ofdev=%s: mismatch ofport=%s, ofport2=%s" % (ofdev, ofport, ofport2))
ofport = ofport2
except Exception as e:
logger.error("teardown_tunnel:gre port is None. ex=%s" % e)
if ofport is not None:
urlbase = src_if.ryu_url
dpid = src_if.dpid
logger.info("teardown gre link here. url=%s, dpid=%s, ovsdb=%s, dev=%s, type=%s, local=%s, remote=%s" %
(urlbase, dpid, src_if.ovsdb, ofdev, src_if.gtype, src_if.address, dst_if.address));
params = {}
params["ovsdb"] = src_if.ovsdb
params["name"] = ofdev
params["remote_ip"] = dst_if.address
ovsif.del_tunnel(urlbase, dpid, params)
# src_if.ofport = None
src_if.set_of(self.ovs_id, ofdev, None)
sw.set_free(ofdev)
开发者ID:dana-i2cat,项目名称:felix,代码行数:31,代码来源:ovsgre.py
示例4: restart
def restart (self):
fmt = "SELECT * from %s"
sql = fmt % mySQLtbl
logger.info("tnrm_db:select: sql=%s" % sql)
try:
self.open()
self.cur.execute(sql)
rows = self.cur.fetchall()
except Exception as e:
logger.error("tnrm_db:restart: ex=%s" % e)
raise e
finally:
self.close()
drows = []
for row in rows:
d = self.row2dict(row)
drows.append(d)
logger.info("tnrm_db:select: row=%s" % self.row2str(d))
if False:
pass
# ep = Endpoint(ep_name, ep_vlantag, node, stp)
# resv = Reservation(None, d["slice_urn"], d["resv_urn"], None, path, d["geni_expires"], d["start_time"]);
manifest = reservation.manifest_rspec + d["manifest_node"] + d["manifest_link"] + reservation.close_rspec;
current_time = datetime.datetime.utcnow()
ic_time = unix_time_sec(current_time)
try:
is_datetime = datetime.datetime.strptime(d["start_time"], '%Y-%m-%d %H:%M:%S.%f')
except Exception as e:
try:
is_datetime = datetime.datetime.strptime(d["start_time"], '%Y-%m-%d %H:%M:%S')
except Exception as ee:
logger.error("restart db: bad start time format: %s" % d["start_time"])
continue
is_time = unix_time_sec(is_datetime)
try:
ie_datetime = datetime.datetime.strptime(d["geni_expires"], '%Y-%m-%d %H:%M:%S.%f')
except Exception as e:
try:
ie_datetime = datetime.datetime.strptime(d["geni_expires"], '%Y-%m-%d %H:%M:%S')
except Exception as ee:
logger.error("restart db: bad start time format: %s" % d["geni_expires"])
continue
ie_time = unix_time_sec(ie_datetime)
# logger.info("start_time: %s, %d" % (d["start_time"], is_time))
# logger.info("end_time: %s, %d" % (d["geni_expires"], ie_time))
# logger.info("current_time: %s, %d" % (current_time, ic_time))
# try:
self.tnrm.re_allocate(
d["slice_urn"], d["resv_urn"], manifest, is_datetime,
ie_datetime, d["nsi_id"], d["transvlan"],
d["geni_operational_status"], d["geni_allocation_status"],
d["geni_error"], d["geni_action"])
开发者ID:ict-felix,项目名称:stack,代码行数:60,代码来源:db.py
示例5: update
def update(self, resv):
fmt = "UPDATE %s SET %s=\"%s\", %s=\"%s\", %s=\"%s\", %s=\"%s\", %s=\"%s\" WHERE resv_urn=\"%s\""
error = resv.error
if error is not None:
error = error.replace("\"", "")
error = error.replace("\'", "")
sql = fmt % (mySQLtbl,
"geni_expires", resv.end_time,
"geni_operational_status", resv.ostatus,
"geni_allocation_status", resv.astatus,
"geni_error", error,
"geni_action", resv.action,
resv.urn)
logger.info("tnrm_db:update: sql=%s" % sql)
try:
self.open()
self.cur.execute(sql)
self.cur.execute("COMMIT")
except Exception as e:
logger.error("tnrm_db:restart: ex=%s" % e)
raise e
finally:
self.close()
开发者ID:ict-felix,项目名称:stack,代码行数:27,代码来源:db.py
示例6: get_port
def get_port(self, dev):
if self.dict_dev.has_key(dev):
port = self.dict_dev[dev]
logger.info("swManager: get_port: dev=%s, ofport=%s" % (dev, port))
return self.dict_dev[dev]
raise ManagerException("ovsgre:swManager:get_port", "This dev(%s) does not exist." % dev)
开发者ID:dana-i2cat,项目名称:felix,代码行数:7,代码来源:ovsgre.py
示例7: status
def status (self, resv):
if resv is None or not dict_resvParameter.has_key(resv.resv_id):
logger.info("ovsManager:status: resv_id=%s" % (resv.resv_id))
for key in dict_resvParameter:
logger.info("ovsManager:status: resvp=%s" % (key))
raise ManagerException("OvsManager:status", "The reservation is null.")
resvp = dict_resvParameter[resv.resv_id]
if resvp is None:
raise ManagerException("OvsManager:status", "The ResvParameter is null.")
rc = self.check_rule(self.src_if, resvp.s_vlan, resvp.t_vlan)
if not rc:
### This operation is caused we can not remove flow rules
### and teardown gre tunnel in a normal island.
# self.dict_isSetRule[resv.resv_id] = False
return False
rc = self.check_rule(self.dst_if, resvp.d_vlan, resvp.t_vlan)
if not rc:
### This operation is caused we can not remove flow rules
### and teardown gre tunnel in a normal island.
# self.dict_isSetRule[resv.resv_id] = False
return False
return True
开发者ID:dana-i2cat,项目名称:felix,代码行数:25,代码来源:ovsgre.py
示例8: get_swManager
def get_swManager (interface):
stp = interface.nsi_stp_id
key = interface.ryu_url + "/" + interface.dpid
logger.info("get_swManager: key=%s" % key)
if dict_swManager.has_key(key):
return dict_swManager[key]
logger.info("get_swManager: new swManager")
sw = swManager(interface)
dict_swManager[key] = sw
return sw
开发者ID:dana-i2cat,项目名称:felix,代码行数:12,代码来源:ovsgre.py
示例9: free
def free (self):
keep = None
try:
self.s_vman.free(self.s_vlan)
except Exception as ex:
logger.info("free: source vlan tun:%s" % (self.s_vlan))
keep = ex
try:
self.d_vman.free(self.d_vlan)
except Exception as ex:
logger.info("destination vlan tun:%s" % (self.d_vlan))
keep = ex
try:
self.t_vman.free(self.t_vlan)
except Exception as ex:
logger.info("tunnel vlan tun:%s" % (self.t_vlan))
keep = ex
if keep is not None:
raise keep
logger.info("freed vlan src:%s, dst:%s, tun:%s" % (self.s_vlan, self.d_vlan, self.t_vlan))
return (self.s_vlan, self.d_vlan, self.t_vlan)
开发者ID:dana-i2cat,项目名称:felix,代码行数:25,代码来源:ovsgre.py
示例10: delete
def delete(self, resv):
fmt = "DELETE FROM %s WHERE resv_urn=\"%s\""
sql = fmt % (mySQLtbl, resv.urn)
logger.info("tnrm_db:delete: sql=%s" % sql)
try:
self.open()
self.cur.execute(sql)
self.cur.execute("COMMIT")
except Exception as e:
logger.error("tnrm_db:delete: ex=%s" % e)
raise e
finally:
self.close()
开发者ID:ict-felix,项目名称:stack,代码行数:15,代码来源:db.py
示例11: update_time
def update_time(self, resv):
fmt = "UPDATE %s SET %s=\"%s\" WHERE resv_urn=\"%s\""
sql = fmt % (mySQLtbl,
"geni_expires", resv.end_time, resv.urn)
logger.info("tnrm_db:update: sql=%s" % sql)
try:
self.open()
self.cur.execute(sql)
self.cur.execute("COMMIT")
except Exception as e:
logger.error("tnrm_db:restart: ex=%s" % e)
raise e
finally:
self.close()
开发者ID:ict-felix,项目名称:stack,代码行数:16,代码来源:db.py
示例12: del_rule
def del_rule(self, interface, sevlan, ofvlan):
urlbase = interface.ryu_url
dpid = interface.dpid
ofdev, ofport = interface.get_of(self.ovs_id)
params = {}
params["dpid"] = int(dpid, 16)
matchs = {"in_port": interface.seport, "dl_vlan": sevlan}
params["match"] = matchs
rc = ovsif.del_flow(urlbase, params)
logger.info("del_rule: ret=%s" % rc)
# matchs = {"in_port": interface.ofport, "dl_vlan": ofvlan}
matchs = {"in_port": ofport, "dl_vlan": ofvlan}
params["match"] = matchs
rc = ovsif.del_flow(urlbase, params)
logger.info("del_rule: ret=%s" % rc)
开发者ID:dana-i2cat,项目名称:felix,代码行数:18,代码来源:ovsgre.py
示例13: allocate
def allocate (self):
try:
self.s_vman.allocate(self.s_vlan)
except Exception as ex:
raise ex
try:
self.d_vman.allocate(self.d_vlan)
except Exception as ex:
self.s_vman.free(self.s_vlan)
raise ex
try:
self.t_vlan = self.t_vman.allocate(self.t_vlan)
except Exception as ex:
self.s_vman.free(self.s_vlan)
self.d_vman.free(self.d_vlan)
raise ex
logger.info("allocated vlan src:%s, dst:%s, tun:%s" % (self.s_vlan, self.d_vlan, self.t_vlan))
return (self.s_vlan, self.d_vlan, self.t_vlan)
开发者ID:dana-i2cat,项目名称:felix,代码行数:21,代码来源:ovsgre.py
示例14: search
def search (self):
for v in xrange(self.vlan_pos, self.vlan_max):
logger.info("ovsgre:vlanManager:search: vlan=%d" % (v))
if self.dict_vlans.has_key(str(v)):
continue
else:
self.vlan_pos = v + 1
if self.vlan_pos == self.vlan_max:
self.vlan_pos = self.vlan_min
return str(v)
for v in xrange(self.vlan_min, self.vlan_pos):
logger.info("ovsgre:vlanManager:search: vlan=%d" % (v))
if self.dict_vlans.has_key(str(v)):
continue
else:
self.vlan_pos = v + 1
if self.vlan_pos == self.vlan_max:
self.vlan_pos = self.vlan_min
return str(v)
raise ManagerException("proxy:allocate_vlan", "New vlan is not allocated.")
开发者ID:dana-i2cat,项目名称:felix,代码行数:22,代码来源:ovsgre.py
示例15: provision
def provision (self, resv):
# provison:nsiv2, poa geni_start
if resv is None or not dict_resvParameter.has_key(resv.resv_id):
logger.info("ovsManager:provision: resv_id=%s" % (resv.resv_id))
for key in dict_resvParameter:
logger.info("ovsManager:provision: resvp=%s" % (key))
raise ManagerException("OvsManager:provision", "The reservation is null.")
resvp = dict_resvParameter[resv.resv_id]
if resvp is None:
raise ManagerException("OvsManager:privision", "The ResvParameter is null.")
if self.isSetup:
# already setup
pass
else:
try:
### setup src->dst
self.setup_tunnel(self.src_if, self.dst_if)
except:
raise
try:
### setup dst->src
self.setup_tunnel(self.dst_if, self.src_if)
except:
### teardown tunnel by setup_tunnel(self.src_if, self.dst_if)
self.teardown_tunnel(self.src_if, self.dst_if)
raise
self.isSetup = True
self.dict_used[resv.resv_id] = resv.resv_id
if self.dict_isSetRule[resv.resv_id]:
# already set flow rule
pass
else:
#### add code for set rule
logger.info("set flow rule. %s?vlan=%s:%s?vlan=%s, gre?vlan=%s." %
(resvp.s_stp, resvp.s_vlan, resvp.d_stp, resvp.d_vlan, resvp.t_vlan))
try:
### add src
self.add_rule(self.src_if, resvp.s_vlan, resvp.t_vlan)
except Exception as ex:
logger.error("provision: error in add rule: src_if=%s sevlan=%s, ofvlan=%s, ex=%s" % (self.src_if, resvp.s_vlan, resvp.t_vlan, ex))
raise ex
try:
### add dst
self.add_rule(self.dst_if, resvp.d_vlan, resvp.t_vlan)
except Exception as ex:
logger.error("provision: error in add rule: dst_if=%s sevlan=%s, ofvlan=%s, ex=%s" % (self.dst_if, resvp.s_vlan, resvp.t_vlan, ex))
self.del_rule(self.src_if, resvp.s_vlan, resvp.t_vlan)
raise ex
self.dict_isSetRule[resv.resv_id] = True
return resv.resv_id
开发者ID:HalasNet,项目名称:felix,代码行数:59,代码来源:ovsgre.py
示例16: __init__
def __init__ (self, ovs_id, resv):
self.ovs_id = ovs_id;
self.resv = resv;
self.s_stp = self.resv.path.sep.stp
self.d_stp = self.resv.path.dep.stp
self.t_stp = getKey(self.s_stp, self.d_stp)
#self.s_vlan = self.resv.path.sep.vlantag
#self.d_vlan = self.resv.path.dep.vlantag
self.s_vlan = self.resv.src_vlan
self.d_vlan = self.resv.dst_vlan
self.t_vlan = self.resv.trans_vlan
self.s_if = self.resv.src_if
self.d_if = self.resv.dst_if
self.s_vman = None
self.d_vman = None
self.t_vman = None
(self.s_vman, self.d_vman, self.t_vman) = get_vlanManager(self.s_stp, self.d_stp)
self.s_ofdev, self.s_ofport = self.s_if.get_of(self.ovs_id)
self.d_ofdev, self.d_ofport = self.d_if.get_of(self.ovs_id)
logger.info("ovsgre:ResvParameter:init: %s" % self)
开发者ID:dana-i2cat,项目名称:felix,代码行数:23,代码来源:ovsgre.py
示例17: reserve
def reserve (self, resv):
# logger.info("ovsgre:OvsManager:reserve: enter")
# This just only reserve vlans for source/destination/tunnel interfaces
if resv is None:
raise ManagerException("OvsManager:reserve", "The reservation parameter is null.")
self.check_stp(resv)
resv_id = uuid.uuid4()
logger.info("ovsManager:reserve: new resv_id=%s." % resv_id)
if dict_resvParameter.has_key(resv_id):
logger.error("Never here. Reservation id is duplicated(%s)." % (resv_id))
raise ManagerException("OvsManager:reserve", "The reservation id is already used.")
resvp = resvParameter(self.ovs_id, resv)
(s_vlan, d_vlan, t_vlan) = resvp.allocate()
resv.trans_vlan = t_vlan
dict_resvParameter[resv_id] = resvp
self.dict_isSetRule[resv_id] = False
logger.info("ovsManager:reserve: done. resv_id=%s" % (resv_id))
return resv_id
开发者ID:dana-i2cat,项目名称:felix,代码行数:24,代码来源:ovsgre.py
示例18: get_ovsManager
def get_ovsManager (src_if, dst_if):
key = get_ovsManagerKey (src_if, dst_if)
logger.info("get_ovsManager: %s" % key)
if dict_ovsManager.has_key(key):
logger.info("get_ovsManager: %s is already exist." % key)
return dict_ovsManager[key]
key = get_ovsManagerKey (dst_if, src_if)
if dict_ovsManager.has_key(key):
logger.info("get_ovsManager: %s is already exist." % key)
return dict_ovsManager[key]
key = get_ovsManagerKey (src_if, dst_if)
ovsManager = OvsManager(src_if, dst_if)
logger.info("get_ovsManager: %s is created now." % key)
dict_ovsManager[key] = ovsManager
return dict_ovsManager[key]
开发者ID:dana-i2cat,项目名称:felix,代码行数:18,代码来源:ovsgre.py
示例19: re_provision
def re_provision (self, resv):
# provison:nsiv2, poa geni_start
logger.info("ovsManager:re_provision has_key(%s)=%s" %
(resv.resv_id, dict_resvParameter.has_key(resv.resv_id)))
if resv is None or not dict_resvParameter.has_key(resv.resv_id):
logger.info("ovsManager:re_provision: resv_id=%s" % (resv.resv_id))
for key in dict_resvParameter:
logger.info("ovsManager:re_provision: resvp=%s" % (key))
raise ManagerException("OvsManager:re_provision", "The reservation is null.")
resvp = dict_resvParameter[resv.resv_id]
if resvp is None:
raise ManagerException("OvsManager:re_privision", "The ResvParameter is null.")
self.isSetup = True
self.dict_used[resv.resv_id] = resv.resv_id
self.dict_isSetRule[resv.resv_id] = True
logger.info("ovsManager:re_provision: done. resv_id=%s" % (resv.resv_id))
return resv.resv_id
开发者ID:dana-i2cat,项目名称:felix,代码行数:20,代码来源:ovsgre.py
示例20: setup_tunnel
def setup_tunnel(self, src_if, dst_if):
logger.info("setup src_if=%s" % src_if)
logger.info("setup dst_if=%s" % dst_if)
sw = get_swManager(src_if)
ofport = None
try:
# ofport = sw.get_port(src_if.ofdev)
ofdev, ofport = src_if.get_of(self.ovs_id)
ofport2 = sw.get_port(ofdev)
if ofport != ofport2:
logger.error("setup_tunnel:ofdev=%s: mismatch ofport=%s, ofport2=%s" % (ofdev, ofport, ofport2))
ofport = ofport2
except Exception as ex:
logger.info("setup_tunnel:gre port is None")
if ofport is None:
urlbase = src_if.ryu_url
dpid = src_if.dpid
logger.info("setup gre link here. url=%s, dpid=%s, ovsdb=%s, dev=%s, type=%s, local=%s, remote=%s" %
(urlbase, dpid, src_if.ovsdb, ofdev, src_if.gtype, src_if.address, dst_if.address));
params = {}
params["ovsdb"] = src_if.ovsdb
params["name"] = ofdev
if (src_if.gtype == "ovsgre"):
params["type"] = "gre"
else:
raise ManagerException("OvsManager:setup_tunnel",
"Type (%s) is unknown, must be \"ovsgre\"." % (src_if.gtype))
params["local_ip"] = src_if.address
params["remote_ip"] = dst_if.address
ofport = ovsif.add_tunnel(urlbase, dpid, params)
# src_if.ofport = ofport
src_if.set_of(self.ovs_id, ofdev, ofport)
sw.set_used(ofdev, ofport)
开发者ID:dana-i2cat,项目名称:felix,代码行数:40,代码来源:ovsgre.py
注:本文中的tn_rm_delegate.logger.info函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论