1 import netconf_constant
2 from netconfclient import NetconfClient
3 from java.lang import Exception
4 from org.onap.ccsdk.apps.blueprintsprocessor.functions.netconf.executor import NetconfComponentFunction
6 class DefaultGetNetConfig(NetconfComponentFunction):
8 def process(self, execution_request):
10 log = globals()[netconf_constant.SERVICE_LOG]
12 #requestId = globals()[netconf_constant.PARAM_REQUEST_ID]
14 nc = NetconfClient(log, self)
17 nc.createRPCServiceFromRequirement("netconf-connection")
19 runningConfigTemplate = "runningconfig-template"
21 runningConfigMessageId = "get-config-" + requestId
23 deviceResponse = nc.getConfig(messageId=runningConfigMessageId,
24 filter=runningConfigTemplate)
26 log.info("Get Running Config Response {} ", deviceResponse.responseMessage)
27 if(deviceResponse !='null') :
28 status = deviceResponse.status
30 if (deviceResponse.status != netconf_constant.STATUS_SUCCESS and deviceResponse.errorMessage != 'null'):
31 errorMessage = "Get Running Config Failure ::"+ deviceResponse.errorMessage
33 except Exception, err:
34 log.error("Exception in the script {}",err.getMessage())
35 status = netconf_constant.STATUS_FAILURE
36 errorMessage = "Get Running Config Failure ::"+err.getMessage()
38 def recover(self, runtime_exception, execution_request):
39 print "Recovering calling.." + PROPERTY_BLUEPRINT_BASE_PATH