-
Notifications
You must be signed in to change notification settings - Fork 7
DeviceModule
| ModuleTypeID (hex) | 0x0002 |
|---|---|
| ModuleTypeID (decimal) | 2 |
| Distribution support | single instance |
| Dependencies | LinkDiscoveryModule |
The DeviceModule knows what devices are connected to the SDN-network. A device is any entity with a MAC-address. SDN-switches do NOT count as devices. Use SwitchAdapter or SwitchRegistryModule to get information about switches.
The configuration file for this module must define the following variable:
Config variable: ZSDN_DEVICE_MODULE_PROTOCOLS_TO_USE
Type: comma separated list
Description: The DeviceModule can use ARP, IPv4 and IPv6 packets to learn about devices in the network. If performance is required, enabling only ARP is recommended. possible config value=ARP,IPv4,IPv6 (casing does not matter)
Query all Devices known to the DeviceModule. Reply can contain 0 or more devices.
| | |
--- | --- | ---
| Request-MessageType | REQUEST.DEVICE_MODULE.GET_ALL_DEVICES |
| Request-Payload | Request-Container +message GetAllDevicesRequest {} |
| Reply-MessageType | REPLY.DEVICE_MODULE.GET_ALL_DEVICES |
| Reply-Payload | Reply-Container + message GetAllDevicesReply { repeated Device devices = 1;} |
Query for a single device. Request must contain MAC address of target device. Reply contains the device with that MAC address, or nothing, if the DeviceModule does not know any device with that MAC address.
| Request-MessageType | [[REQUEST.DEVICE_MODULE.GET_DEVICE_BY_MAC_ADDRESS |
| Request-Payload | [[Request-Container |
| Reply-MessageType | [[REPLY.DEVICE_MODULE.GET_DEVICE_BY_MAC_ADDRESS |
| Reply-Payload | [[Reply-Container |
Queries all devices matching the filters provided in the request. A device has to satisfy all provided filters in order to be present in the reply. The reply may contain 0 or more devices.
| Request-MessageType | [[REQUEST.DEVICE_MODULE.GET_DEVICES_BY_FILTER |
| Request-Payload | [[Request-Container |
| Reply-MessageType | [[REPLY.DEVICE_MODULE.GET_DEVICES_BY_FILTER |
| Reply-Payload | [[Reply-Container |
When a device is added, removed, or changed one of its attributes, an event of this type is published.
| From-MessageType | [[FROM.DEVICE_MODULE.DEVICE_EVENT.*(ADDED/REMOVED/CHANGED) |
| From-Payload | [[From-Container |
For a detailed list of all supported topics, see the DeviceModule.topics file.
Enabling:
By enabling this Module it subscribes itself to the configured packet_in topics of the SwitchAdapter. Possible packet_ins are for example:
- ARP packet_in
- IPv4 packet_in
- IPv6 packet_in
The information contained in these packet_ins is used for discovering Devices according to the sender information submitted.
Additionally the DeviceModule requests all Links between Switches for detection whether an added Device possibly may be a Switch and is therefore invalid.
Packet_in handling:
- From the ZmfMessage retrieved the necessary information is extracted.
- Switch ID and Port is received always (no matter which packet_in type)
- For ARP packet_ins the sender IPv4 address and the sender MAC address is stored together with the information about the Switch.
- For IPv4 packet_ins the source IPv4 address and the source MAC address is stored together with the information about the Switch.
- For IPv6 packet_ins the source IPv6 address and the source MAC address is stored together with the information about the Switch.
All Devices registered by the above describes method are stored in a Map. This Map has the MAC address of a Device as key and the Device itself as value.
Adding / Updating / Removing a Device:
- If a Device (with its corresponding MAC address) is not already registered at the DeviceModule the device gets added. If a new Device was added the DeviceModule publishes a DEVICE_EVENT ADDED.
- If the Device is already known to the DeviceModule checks whether this Device needs an update. If values are updated the DeviceModule publishes a DEVICE_EVENT CHANGED.
- If an added Device is detected as a Switch by the DeviceModule this specific Device will be removed and the DeviceModule publishes a DEVICE_EVENT REMOVED.
Switch Detection:
- The DeviceModule validates its known Devices against the known Switches retrieved by the LinkDiscoveryModule.
- A Device therefore is not valid if it is detected as a Switch. This Device will then be removed.
Request handling:
- Incoming requests are handled internally to the specific request type. According to these types the correct replies are generated and returned.
- If the given request type was unknown a reply with ReplyType NO_REPLY is returned.
MessageType: FROM.SWITCH_ADAPTER.OPENFLOW.PACKET_IN.ARP
Comment: Receiving ARP-packets to find out about IPv4 based devices.
MessageType: FROM.SWITCH_ADAPTER.OPENFLOW.PACKET_IN.IPv4
Comment: Receiving IPv4-packets to find out about IPv4 based devices.
MessageType: FROM.SWITCH_ADAPTER.OPENFLOW.PACKET_IN.IPv6
Comment: Receiving IPv6-packets to find out about IPv6 based devices.


