def _generate_goodbye(xmlns, netconf_namespace, message_id): """general final goodbye message""" goodbye_dict = { netconf_namespace + '@close-session': None, '_@@message-id': message_id } goodbye_xml = utils.generate_xml_node(goodbye_dict, xmlns, netconf_namespace + '@rpc') return etree.tostring(goodbye_xml, pretty_print=True, xml_declaration=True, encoding='UTF-8')
def _generate_goodbye(xmlns, netconf_namespace, message_id): """general final goodbye message""" goodbye_dict = { netconf_namespace + '@close-session': None, '_@@message-id': message_id } goodbye_xml = utils.generate_xml_node( goodbye_dict, xmlns, netconf_namespace + '@rpc' ) return etree.tostring( goodbye_xml, pretty_print=True, xml_declaration=True, encoding='UTF-8' )
def _generate_hello(xmlns, netconf_namespace, capabilities): """generate initial hello message with capabilities""" if not capabilities: capabilities = [] if netconf_connection.NETCONF_1_0_CAPABILITY not in capabilities: capabilities.append(netconf_connection.NETCONF_1_0_CAPABILITY) if netconf_connection.NETCONF_1_1_CAPABILITY not in capabilities: capabilities.append(netconf_connection.NETCONF_1_1_CAPABILITY) hello_dict = { netconf_namespace + '@capabilities': { netconf_namespace + '@capability': capabilities } } hello_xml = utils.generate_xml_node(hello_dict, xmlns, netconf_namespace + '@hello') return etree.tostring(hello_xml, pretty_print=True, xml_declaration=True, encoding='UTF-8')
def _generate_hello(xmlns, netconf_namespace, capabilities): """generate initial hello message with capabilities""" if not capabilities: capabilities = [] if netconf_connection.NETCONF_1_0_CAPABILITY not in capabilities: capabilities.append(netconf_connection.NETCONF_1_0_CAPABILITY) if netconf_connection.NETCONF_1_1_CAPABILITY not in capabilities: capabilities.append(netconf_connection.NETCONF_1_1_CAPABILITY) hello_dict = { netconf_namespace + '@capabilities': { netconf_namespace + '@capability': capabilities } } hello_xml = utils.generate_xml_node( hello_dict, xmlns, netconf_namespace + '@hello' ) return etree.tostring( hello_xml, pretty_print=True, xml_declaration=True, encoding='UTF-8' )