本文整理汇总了Python中sm.so.service_orchestrator.LOG类的典型用法代码示例。如果您正苦于以下问题:Python LOG类的具体用法?Python LOG怎么用?Python LOG使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LOG类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, token, tenant):
# this python thread event is used to notify the SOD that the runtime phase can execute its logic
self.event = threading.Event()
self.so_e = ServiceOrchestratorExecution(token, tenant, self.event)
self.so_d = ServiceOrchestratorDecision(self.so_e, token, self.event)
LOG.debug('Starting SOD thread...')
self.so_d.start()
开发者ID:MobileCloudNetworking,项目名称:mobaas,代码行数:7,代码来源:so.py
示例2: deploy
def deploy(self):
"""
deploy SICs.
"""
LOG.debug('Executing deployment logic')
if self.stack_id is None:
self.stack_id = self.deployer.deploy(self.template, self.token)
开发者ID:MobileCloudNetworking,项目名称:mobaas,代码行数:7,代码来源:so.py
示例3: get_endpoint
def get_endpoint(service_type, endpoint_type=None,region_name=None):
from clients import keystone
# ##Init keystone client
ksclient = keystone.Client()
endpoint = ksclient.get_endpoint(service_type=service_type, endpoint_type=endpoint_type, region_name=region_name)
LOG.debug("endpoint for service_type %s is %s" %(service_type,endpoint,))
return endpoint
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:7,代码来源:SysUtil.py
示例4: list_net
def list_net(self):
res = []
LOG.debug('Requesting list of networks...')
lst = self.neutron.list_networks()
for net in lst.get('networks'):
res.append(Network(net.get('name'), net.get('id'), net.get('router:external')))
return res
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:7,代码来源:neutron.py
示例5: update
def update(self, provisioning = False, attributes = None):
"""
deploy updated SICs.
"""
LOG.debug('Executing update deployment logic')
# Check if attributes are being updated
if attributes:
if 'mcn.endpoint.maas' in attributes:
self.maas_endpoint = str(attributes['mcn.endpoint.maas'])
if 'mcn.endpoint.mobaas' in attributes:
self.mobaas_endpoint = str(attributes['mcn.endpoint.mobaas'])
# Get new template
generator = icnaas.template_generator.ICNaaSTemplateGenerator(self.routers, self.maas_endpoint, \
self.mobaas_endpoint)
template = generator.generate(provisioning, FMC_ENABLED)
# Wait for any pending operation to complete
while (True):
if self.stack_id is not None:
tmp = self.deployer.details(self.stack_id, self.token)
if tmp['state'] == 'CREATE_COMPLETE' or tmp['state'] == 'UPDATE_COMPLETE':
break
else:
time.sleep(10)
# Deploy new template
if self.stack_id is not None:
self.deployer.update(self.stack_id, template, self.token)
# Mark as updated for SOD
self.updated = True
开发者ID:MobileCloudNetworking,项目名称:icnaas,代码行数:28,代码来源:so.py
示例6: run
def run(self):
"""
Decision part implementation goes here.
"""
while True:
# It is unlikely that logic executed will be of any use until the provisioning phase has completed
LOG.debug('Waiting for deploy and provisioning to finish')
self.event.wait()
LOG.debug('Starting runtime logic...')
# Decision logic
# Until service instance is destroyed
while self.so_e.stack_id is not None:
# Check if update is complete
while True:
tmp = self.so_e.deployer.details(self.so_e.stack_id, self.so_e.token)
if tmp['state'] == 'UPDATE_COMPLETE':
break
else:
time.sleep(10)
# Set updated back to False
self.so_e.updated = False
# Update the information about CCNx routers
self.so_e.state()
# Then, attempt to connect to MaaS
self.monitor = icnaas.monitor.ICNaaSMonitorCCNRouter(self.so_e.maas_endpoint)
# Afterwards, keep checking the metrics until service is updated
while not self.so_e.updated:
self.check_metrics()
for i in range(0, 6):
if self.so_e.updated:
break
time.sleep(10)
self.event = ready_event
开发者ID:MobileCloudNetworking,项目名称:icnaas,代码行数:33,代码来源:so.py
示例7: checkRequirementsDependencies
def checkRequirementsDependencies(requirements=[], service_instances=[]):
for requirement in requirements:
try:
counter = 0
LOG.debug("Check dependencies for requirement \"%s\"." % requirement.name)
for service_instance in service_instances:
if requirement.source == service_instance.name:
LOG.debug("source \"%s\" was found." % requirement.source)
if requirement.parameter == 'private_ip' or requirement.parameter == 'public_ip':
LOG.debug("parameter \"%s\" is available." % requirement.parameter)
for obj in service_instance.networks:
if requirement.obj_name == obj.name:
LOG.debug("obj_name \"%s\" was found." % requirement.obj_name)
counter += 1
else:
raise InvalidInputException("parameter:\"%s\" is not available." % requirement.parameter)
if counter == 0:
raise NotFoundException("requirement:\"%s\" was not found (\"source:%s\", \"obj_name:%s\")." % (
requirement.name, requirement.source, requirement.obj_name))
elif counter == 1:
LOG.debug("requirement \"%s\" is valid." % requirement.name)
else:
raise InvalidInputException("is not valid. Found sources or objects several times.")
except Exception, exc:
exc.message = 'Requirement:\"%s\"->%s' % (requirement.name, exc.message)
raise exc
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:26,代码来源:Checker.py
示例8: provision
def provision(self):
# super(SOEExtn, self).provision()
# TODO check that the provision descriptor is present
# TODO: refactor this to: for region_name, region in self.service_manifest['resources'].iteritems()
for region in self.service_manifest['resources'].keys():
if len(self.service_manifest['resources'][region]['stack_id']) > 0:
self.service_manifest['resources'][region]['client'].update(self.service_manifest['resources'][region]['stack_id'],
self.service_manifest['resources'][region]['provision'], self.token)
LOG.info('Stack ID: ' + self.service_manifest['resources'][region]['stack_id'])
if self.db:
# persist data
document_filter = {
"_id": self.service_manifest['resources'][region]['stack_id'],
"region": region
}
data = {
"_id": self.service_manifest['resources'][region]['stack_id'],
"token": self.token,
"region": region,
"provision": self.service_manifest['resources'][region]['provision']
}
current = self.db.find_one(document_filter)
if not current:
self.db.insert(data)
else:
self.db.update_one(document_filter, {
"$set": {
'provision': data['provision'],
'token': data['token']
}
})
开发者ID:icclab,项目名称:hurtle_sample_so,代码行数:35,代码来源:so.py
示例9: checkNetworksUniqueness
def checkNetworksUniqueness(networks):
LOG.debug("\"Check uniqueness of networks.\"")
for network in networks:
for comp_network in networks:
if network.name == comp_network.name and network != comp_network:
raise NotUniqueException("network:\"%s\" is not unique." % network.name)
LOG.debug("network \"%s\" is unique." % network.name)
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:7,代码来源:Checker.py
示例10: check
def check(action=None, alarm=None, flavor=None, image=None, key=None, network=None, policy=None, security_group=None,
service=None, service_instance=None, service_type=None, topology=None, unit=None):
try:
if action:
checkAction(action)
if alarm:
checkAlarm(alarm)
if flavor:
checkFlavor(flavor)
if image:
checkImage(image)
if key:
checkKey(key)
if network:
checkNetwork(network)
if policy:
checkPolicy(policy)
if security_group:
checkSecurityGroupUniqueness(security_group)
checkSecurityGroup(security_group)
if service:
checkServiceUniqueness(service)
checkService(service)
if service_instance:
checkServiceInstance(service_instance)
if service_type:
checkServiceType(service_type)
if topology:
checkTopolgoyUniqueness(topology)
checkTopology(topology)
if unit:
checkUnit(unit)
except Exception, exc:
LOG.exception(exc)
raise
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:35,代码来源:Checker.py
示例11: checkPoliciesUnqiueness
def checkPoliciesUnqiueness(policies):
LOG.debug("Check uniqueness of policies.")
for policy in policies:
for comp_policy in policies:
if policy.name == comp_policy and policy != comp_policy:
raise NotUniqueException("policy:\"%s\" is not unique." % policy.name)
LOG.debug("policy \"%s\" is unique." % policy.name)
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:7,代码来源:Checker.py
示例12: checkTopolgoyUniqueness
def checkTopolgoyUniqueness(topology):
db = DatabaseManager()
# check names
LOG.debug("Check uniqueness of name of the toplogy \"%s\"." % topology.name)
for top in db.get_all(Topology):
if topology.ext_name == top.ext_name and topology.id != top.id:
raise NotUniqueException("Topology name \"%s\" is already used." % topology.name)
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:7,代码来源:Checker.py
示例13: update
def update(self, attributes):
"""
It configures a running EPCaaS using parameters passed by SM.
:param attributes: is a dict that contains the OCCI attributes passed
by SM (X-OCCI-ATTRIBUTE)
"""
LOG.debug("Executing update/provisioning logic")
stack_state, stack_id, output = self.state()
if not (stack_state == "CREATE_COMPLETE" or stack_state == "UPDATE_COMPLETE"):
LOG.debug("Stack is not in a stable state a.t.m.. Retry")
return False
confg = Configurator(
token=self.token,
tenant=self.tenant_name,
region=self.region_name,
sm_parameters=self.sm_parameters,
conf_param=self.conf_param,
attributes=attributes,
epc_config=self.epc_config,
output=output,
event=self.event,
)
# XXX no management of this thread is done
confg.start()
开发者ID:MobileCloudNetworking,项目名称:epcaas,代码行数:30,代码来源:so.py
示例14: provision
def provision(self, attributes):
"""
Takes care of the provisioning of a deployed instance of OpenEPC
It calls the service-specific, implementation-specific method to
actually configure service parameters on the SIC
:param attributes: OCCI attributes passed by SM. Must match the
attributes definition of the service in the SM. E.g. in this way
the SM can pass to a SO parameters to be used in the config call.
This
is useful when an higher level SM, e.g. an E2E SM, manages also one
or more support services, like DNSaaS or MaaS. The E2E SM will pass
the EPCaaS SM the relevant parameters of the support services,
like e.g. IP address for managing a MaaS.
"""
# SR 16/6/2015: currently empty,
# since the epcaas VMs will be configured when the MaaS and DNSaaS ip
# addresses will be available, namely when update is called from the
# SM.
LOG.debug("Executing provisioning logic")
# NOTE: change this when real params are passed to config
# parameters = attributes
# if self.epc_config.config(parameters=parameters) != 0:
# LOG.debug('Provisioning failed')
pass
开发者ID:MobileCloudNetworking,项目名称:epcaas,代码行数:28,代码来源:so.py
示例15: state
def state(self):
"""
Report on state.
"""
# TODO ideally here you compose what attributes should be returned to the SM
# In this case only the state attributes are returned.
resolver_state = self.resolver.state()
LOG.info('Resolver state:')
LOG.info(resolver_state.__repr__())
if self.stack_id is not None:
tmp = self.deployer.details(self.stack_id, self.token)
# Update routers dictionary and service endpoint
if tmp.get('output', None) is not None:
for i in tmp['output']:
# CCNx Router IP
if i['output_key'].startswith('mcn.ccnx'):
router_id = i['output_key'].split('.')[2][6:]
self.routers[int(router_id)]['public_ip'] = str(i['output_value'])
# ICNaaS Service Endpoint
elif i['output_key'] == 'mcn.endpoint.icnaas':
self.endpoint = 'http://' + str(i['output_value']) + ':5000'
i['output_value'] = self.endpoint
return tmp['state'], self.stack_id, tmp['output']
else:
return tmp['state'], self.stack_id, None
else:
return 'Unknown', 'N/A'
开发者ID:MobileCloudNetworking,项目名称:icnaas,代码行数:29,代码来源:so.py
示例16: create_tables
def create_tables(engine):
"""
Drop all and recreate
"""
LOG.debug("drop and create tables")
Base.metadata.drop_all(engine)
Base.metadata.create_all(engine)
开发者ID:MobileCloudNetworking,项目名称:maas,代码行数:7,代码来源:Entities.py
示例17: design
def design(self):
LOG.info("designing stack")
"""
Do initial design steps here.
"""
LOG.info('Entered design() - nothing to do here')
开发者ID:Pentadactylus,项目名称:testso,代码行数:7,代码来源:so.py
示例18: __init__
def __init__(self, so_e, token, tenant_name, ready_event, stop_event):
# super(EPCSODecision, self).__init__(so_e, token, tenant_name)
service_orchestrator.Decision.__init__(self, so_e, token, tenant_name)
threading.Thread.__init__(self)
self.ready_event = ready_event
self.stop_event = stop_event
self.so_e = so_e
self.token = token
self.pol_eng = PolicyEngine()
self.scaling_allowed = True
# self.scaleout_triggered = True
# self.scaleout_success = True
# self.scalein_triggered = True
# self.scalein_success = True
# time.time() when last MME scaling (up/down) occured
self.last_mme_scaling_time = 0
# time.time() when last GW scaling (up/down) occured
self.last_gw_scaling_time = 0
self.num_of_mme = 1
self.num_of_gw = 1
LOG.debug("EPC SO Decision init")
开发者ID:MobileCloudNetworking,项目名称:epcaas,代码行数:28,代码来源:so.py
示例19: provision
def provision(self):
""" Provision SICs
Run scripts.
"""
LOG.info('Calling provision...')
stack_outputs =\
self.deployer.details(self.stack_id, self.token)['output']
# Store host IPs in a dictionary (host_ips),
# where key = $(HOST_NAME)_{external, private}_ip
# e.g. ralf public ip => host_ips['ralf_external_ip']
# e.g. dns private ip => host_ips['dns_private_ip']
self.host_ips = {}
for o in stack_outputs:
self.host_ips[o['output_key']] = o['output_value']
LOG.info('Host IPs: %s' % self.host_ips)
# Create temporary PEM file
self._save_file(self.pem_path, self._get_private_key())
# Provision DNS
self._provision_dns()
# Provision ClearWater components
components = ['homer', 'homestead', 'sprout', 'bono', 'ellis', 'ralf']
processes = {}
for c in components:
processes[c] = Process(target=self._provision_cw_comp, args=(c,))
processes[c].start()
for k in processes.keys():
processes[k].join()
self._delete_file(self.pem_path)
开发者ID:icclab,项目名称:acen-ims,代码行数:33,代码来源:so.py
示例20: state
def state(self):
"""
Report on state.
"""
state = "Unknown"
svc_insts = "None"
insts = ""
resolver_state = self.resolver.state()
LOG.info("Resolver state:" + resolver_state.__repr__())
# XXX might there be the case where the value is just CREATE_COMPLETE?
try:
for key in resolver_state.keys():
if str(resolver_state[key]["occi.mcn.stack.state"]) != "UPDATE_COMPLETE":
state = "Unknown"
break
else:
state = resolver_state[key]["occi.mcn.stack.state"]
insts = insts + key + " "
svc_insts = insts[0:-1]
except KeyError:
pass
return state, svc_insts
开发者ID:dizz,项目名称:dss-e2e,代码行数:25,代码来源:so.py
注:本文中的sm.so.service_orchestrator.LOG类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论