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/06/08 09:23] 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
Zeile 21: Zeile 25:
  
 ==== MQTT-Netconf-YANG Bridge ==== ==== MQTT-Netconf-YANG Bridge ====
 +**LED-Color: blue**
 <code bash> <code bash>
 mosquitto_pub -d -h localhost -p 1883 -t "yang/config" -m ' 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" } },  +"device":{ "description": "MQTT-Device identified by UUID", 
-"rpc": { " + "uuid":{ "type": "string", "value": "F97dfF79-8A12-4F4F-8F69-6B8F3C2EdadDD" }, 
-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" } } }, + "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" } } }' "switch_off": { "description": "Switches the LIFX-Led off", "mqtt-command": "OFF" } } }'
 </code> </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> <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" } } }'+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> </code>
  
 +**LED-Color: green + blue**
 <code bash> <code bash>
 mosquitto_pub -d -h localhost -p 1883 -t "yang/config" -m ' mosquitto_pub -d -h localhost -p 1883 -t "yang/config" -m '
Zeile 42: Zeile 122:
 </code> </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) 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/>') n = xml_.to_ele('<get-schema/>')
 m.dispatch(n) m.dispatch(n)
 +</code>
  
 +<code python>
 n = xml_.to_ele('<get/>') n = xml_.to_ele('<get/>')
 n = xml_.to_ele('<set_color_blue><uuid>12345</uuid></set_color_blue>') 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('<set_color_green><uuid>12345</uuid></set_color_green>')
 n = xml_.to_ele('<switch_off><uuid>1fff</uuid></switch_off>') n = xml_.to_ele('<switch_off><uuid>1fff</uuid></switch_off>')
 +</code>
  
 :!: **ACHTUNG:** Server stürzt ab, wenn kein UUID tag angegeben wird. :!: **ACHTUNG:** Server stürzt ab, wenn kein UUID tag angegeben wird.
  
-Setup in iTerm: (cd /Users/Thomas/LIFX/demo) +Setup in iTerm: (''cd /Users/Thomas/LIFX/demo''): 
-Links: mqtt/LIFX bridge (./mqtt) +  Links: ''mqtt/LIFX bridge (./mqtt)'' 
-Mitte: mqtt_publisher (send json) +  Mitte: ''mqtt_publisher (send json)'' 
-Rechts: mqtt_subscriber (mosquitto_sub -d -h localhost -p 1883 -t "#"+  Rechts: ''mqtt_subscriber (mosquitto_sub -d -h localhost -p 1883 -t "#")'' 
-Unten: /usr/local/sbin/mosquitto -c ./mqtt.conf+  Unten: ''/usr/local/sbin/mosquitto -c ./mqtt.conf''
  
-**Terminal:**  +==== Terminal: ====
-Virtenv starten: +
  
-NETCONF/MQTT bridge: python -i netconf_Server.py +**Virtenv starten:**  
- Achtung: MQTT Broker muss vorher gestartet sein! +<code bash> 
-ncclient:  +source python-virtenv/bin/activate 
-from ncclient import manager +</code>
-from ncclient import xml_+
  
  
 +**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: for capability in m.server_capabilities:
 ...             print(capability) ...             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) 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.1496913781.txt.gz · Zuletzt geändert: 2017/06/08 09:23 von admin