本文整理汇总了Python中helpers.Helpers.get_onos_info方法的典型用法代码示例。如果您正苦于以下问题:Python Helpers.get_onos_info方法的具体用法?Python Helpers.get_onos_info怎么用?Python Helpers.get_onos_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类helpers.Helpers
的用法示例。
在下文中一共展示了Helpers.get_onos_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_record
# 需要导入模块: from helpers import Helpers [as 别名]
# 或者: from helpers.Helpers import get_onos_info [as 别名]
def delete_record(self, model):
onos_fabric_service = self.get_onos_fabric_service(model)
onos = Helpers.get_onos_info(onos_fabric_service.leaf_model)
onos_basic_auth = HTTPBasicAuth(onos['user'], onos['pass'])
data = {
"prefix": model.prefix,
"nextHop": model.next_hop
}
url = '%s:%s/onos/routeservice/routes' % (onos['url'], onos['port'])
request = requests.delete(url, json=data, auth=onos_basic_auth)
if request.status_code != 204:
log.error("Request failed", response=request.text)
raise Exception("Failed to delete static route %s via %s in ONOS" % (model.prefix, model.next_hop))
else:
try:
print request.json()
except Exception:
print request.text