Benutzer-Werkzeuge

Webseiten-Werkzeuge


ne:netzwerkmanagement

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
ne:netzwerkmanagement [2017/03/02 08:57] – [Netzwerkmanangement] adminne:netzwerkmanagement [2018/01/31 13:41] (aktuell) – [Netconf & YANG] admin
Zeile 1: Zeile 1:
 ====== Netzwerkmanangement ====== ====== Netzwerkmanangement ======
  
-  * https://keepingitclassless.net/2015/03/sdn-protocols-part-5-netconf/ 
 ===== Netconf & YANG ===== ===== Netconf & YANG =====
 +  * http://www.netconfcentral.org/netconf_docs
 +  * https://keepingitclassless.net/2015/03/sdn-protocols-part-5-netconf/
 +  * http://www.seguesoft.com/yang-primer
 +  * [[https://communities.cisco.com/community/developer/dna/blog/2017/01/04/next-generation-network-device-programming-part1|Getting Started with NETCONF/YANG – Part 1 (Cisco)]]
 +
  
   * https://trac.ietf.org/trac/netconf   * https://trac.ietf.org/trac/netconf
 +  * https://www.juniper.net/techpubs/en_US/junos/topics/task/operational/netconf-session-request-sending.html
 +  * https://www.juniper.net/techpubs/en_US/junos/topics/task/operational/netconf-requesting-configuration-committed-and-device-info.html
  
 +  * https://www.juniper.net/techpubs/en_US/junos/topics/task/operational/netconf-yang-rpcs-custom-retrieving-operational-information.html
 ==== RFCs ==== ==== RFCs ====
   * [[https://tools.ietf.org/html/rfc6020| RFC 6020:  YANG - A Data Modeling Language for   * [[https://tools.ietf.org/html/rfc6020| RFC 6020:  YANG - A Data Modeling Language for
Zeile 11: Zeile 18:
   * [[https://tools.ietf.org/html/rfc6244| RFC 6244: An Architecture for    * [[https://tools.ietf.org/html/rfc6244| RFC 6244: An Architecture for 
               Network Management Using NETCONF and YANG]]                           Network Management Using NETCONF and YANG]]            
 +              
 +                   
 +==== Tools ====
 +
 +  * https://github.com/CiscoDevNet/yang-explorer
 +
 +==== MQTT-Netconf-YANG Bridge ====
 +**LED-Color: blue**
 +<code bash>
 +mosquitto_pub -d -h localhost -p 1883 -t "yang/config" -m '
 +"device":{ "description": "MQTT-Device identified by UUID",
 + "uuid":{ "type": "string", "value": "F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD" },
 + "device-category":{ "description": "Identifies the device category", "type": "string", "value":"L-LAMP" } }, 
 +"rpc": { "set_color_blue": { "description": "RPC call that sets the LED Color to blue",
 + "mqtt-command": "BLUE", "input": { "uuid": { "description": "Sends request to device specified by uuid", "type": "string" } } }, 
 +"switch_off": { "description": "Switches the LIFX-Led off", "mqtt-command": "OFF" } } }'
 +</code>
 +
 +<code json>
 +{  
 +   "device":{  
 +      "description":"MQTT-Device identified by UUID",
 +      "uuid":{  
 +         "type":"string",
 +         "value":"F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD"
 +      },
 +      "device-category":{  
 +         "description":"Identifies the device category",
 +         "type":"string",
 +         "value":"L-LAMP"
 +      }
 +   },
 +   "rpc":{  
 +      "set_color_blue":{  
 +         "description":"RPC call that sets the LED Color to blue",
 +         "mqtt-command":"BLUE",
 +         "input":{  
 +            "uuid":{  
 +               "description":"Sends request to device specified by uuid",
 +               "type":"string"
 +            }
 +         }
 +      },
 +      "switch_off":{  
 +         "description":"Switches the LIFX-Led off",
 +         "mqtt-command":"OFF"
 +      }
 +   }
 +}
 +</code>
 +
 +**LED-Color: green**
 +<code bash>
 +mosquitto_pub -d -h localhost -p 1883 -t "yang/config" -m '{ "device":{ "description": "MQTT-Device identified by UUID",
 + "uuid":{ "type": "string", "value": "F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD" },
 + "device-category":{ "description": "Identifies the device category", "type": "string", "value":"L-LAMP" } },
 + "rpc": { "set_color_green": { "description": "RPC call that sets the LED Color to green",
 + "mqtt-command": "GREEN", "input": { "uuid": { "description": "Sends request to device specified by uuid",
 + "type": "string" } } }, "switch_off": { "description": "Switches the LIFX-Led off", "mqtt-command": "OFF" } } }'
 +</code>
 +
 +<code json>
 +{  
 +   "device":{  
 +      "description":"MQTT-Device identified by UUID",
 +      "uuid":{  
 +         "type":"string",
 +         "value":"F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD"
 +      },
 +      "device-category":{  
 +         "description":"Identifies the device category",
 +         "type":"string",
 +         "value":"L-LAMP"
 +      }
 +   },
 +   "rpc":{  
 +      "set_color_green":{  
 +         "description":"RPC call that sets the LED Color to green",
 +         "mqtt-command":"GREEN",
 +         "input":{  
 +            "uuid":{  
 +               "description":"Sends request to device specified by uuid",
 +               "type":"string"
 +            }
 +         }
 +      },
 +      "switch_off":{  
 +         "description":"Switches the LIFX-Led off",
 +         "mqtt-command":"OFF"
 +      }
 +   }
 +}
 +</code>
 +
 +**LED-Color: green + blue**
 +<code bash>
 +mosquitto_pub -d -h localhost -p 1883 -t "yang/config" -m '
 +"device":{ "description": "MQTT-Device identified by UUID", "uuid":{ "type": "string", "value": "F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD" }, "device-category":{ "description": "Identifies the device category", "type": "string", "value":"L-LAMP" } }, 
 +"rpc":
 +"set_color_blue": { "description": "RPC call that sets the LED Color to blue", "mqtt-command": "BLUE", "input": { "uuid": { "description": "Sends request to device specified by uuid", "type": "string" } } },
 +"set_color_green": { "description": "RPC call that sets the LED Color to green", "mqtt-command": "GREEN", "input": { "uuid": { "description": "Sends request to device specified by uuid", "type": "string" } } }, 
 +"switch_off": { "description": "Switches the LIFX-Led off", "mqtt-command": "OFF" } } }'
 +</code>
 +
 +<code json>
 +{  
 +   "device":{  
 +      "description":"MQTT-Device identified by UUID",
 +      "uuid":{  
 +         "type":"string",
 +         "value":"F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD"
 +      },
 +      "device-category":{  
 +         "description":"Identifies the device category",
 +         "type":"string",
 +         "value":"L-LAMP"
 +      }
 +   },
 +   "rpc":{  
 +      "set_color_blue":{  
 +         "description":"RPC call that sets the LED Color to blue",
 +         "mqtt-command":"BLUE",
 +         "input":{  
 +            "uuid":{  
 +               "description":"Sends request to device specified by uuid",
 +               "type":"string"
 +            }
 +         }
 +      },
 +      "set_color_green":{  
 +         "description":"RPC call that sets the LED Color to green",
 +         "mqtt-command":"GREEN",
 +         "input":{  
 +            "uuid":{  
 +               "description":"Sends request to device specified by uuid",
 +               "type":"string"
 +            }
 +         }
 +      },
 +      "switch_off":{  
 +         "description":"Switches the LIFX-Led off",
 +         "mqtt-command":"OFF"
 +      }
 +   }
 +}
 +</code>
 +
 +<code python>
 +m = manager.connect_ssh("localhost", port=44555, username="Thomas", password="admin",allow_agent=False,hostkey_verify=False,look_for_keys=False)
 +n = xml_.to_ele('<get-schema/>')
 +m.dispatch(n)
 +</code>
 +
 +<code python>
 +n = xml_.to_ele('<get/>')
 +n = xml_.to_ele('<set_color_blue><uuid>12345</uuid></set_color_blue>')
 +n = xml_.to_ele('<set_color_green><uuid>12345</uuid></set_color_green>')
 +n = xml_.to_ele('<switch_off><uuid>1fff</uuid></switch_off>')
 +</code>
 +
 +:!: **ACHTUNG:** Server stürzt ab, wenn kein UUID tag angegeben wird.
 +
 +Setup in iTerm: (''cd /Users/Thomas/LIFX/demo''):
 +  * Links: ''mqtt/LIFX bridge (./mqtt)''
 +  * Mitte: ''mqtt_publisher (send json)''
 +  * Rechts: ''mqtt_subscriber (mosquitto_sub -d -h localhost -p 1883 -t "#")''
 +  * Unten: ''/usr/local/sbin/mosquitto -c ./mqtt.conf''
 +
 +==== Terminal: ====
 +
 +**Virtenv starten:** 
 +<code bash>
 +source python-virtenv/bin/activate
 +</code>
 +
 +
 +**NETCONF/MQTT bridge:** 
 +<code bash>
 +python -i netconf_Server.py   # Achtung: MQTT Broker muss vorher gestartet sein!
 +</code>
 +
 +**ncclient:** 
 +<code python>
 +from ncclient import manager
 +from ncclient import xml_
 +</code>
 +
 +
 +<code python>
 +for capability in m.server_capabilities:
 +...             print(capability)
 +</code>
 +
 +<code python>
 +m = manager.connect_ssh('ios-xe-mgmt.cisco.com', port=10000, username="root", password='C!sc0123',allow_agent=False,hostkey_verify=False,look_for_keys=False)
 +</code>
ne/netzwerkmanagement.1488445069.txt.gz · Zuletzt geändert: 2017/03/02 08:57 von admin