Skip to content

Commit

Permalink
CP-49930: Moved wlan.py from scripts/poweron to python3/poweron
Browse files Browse the repository at this point in the history
- Modified  Makefile in python3 directory  to include wlan.py
- Fixed pytest error
- Removed wlan.py from scripts/Makefile

Signed-off-by: Ashwinh <ashwin.h@cloud.com>
  • Loading branch information
ashwin9390 committed Jun 18, 2024
1 parent 1c4847d commit 5264939
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 3 additions & 0 deletions python3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ install:
$(IPROG) bin/xe-scsi-dev-map $(DESTDIR)$(OPTDIR)/bin
install -d -m 755 $(DESTDIR)$(PLUGINDIR)
$(IPROG) plugins/disk-space $(DESTDIR)$(PLUGINDIR)
# poweron
$(IPROG) poweron/wlan.py $(DESTDIR)$(PLUGINDIR)/wlan.py
$(IPROG) poweron/wlan.py $(DESTDIR)$(PLUGINDIR)/wake-on-lan
7 changes: 4 additions & 3 deletions scripts/poweron/wlan.py → python3/poweron/wlan.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ def get_physical_pif(session, pif_ref):


def wake_on_lan(session, host, remote_host_uuid):
"""
Attempt to wake up a machine by sending Wake-On-Lan packets encapsulated within UDP datagrams
sent to the broadcast_addr.
"""
# Find this Host's management interface:
this_pif = find_host_mgmt_pif(session, inventory.get_localhost_uuid())
# Find the name of the bridge to which it is connected:
Expand All @@ -79,9 +83,6 @@ def wake_on_lan(session, host, remote_host_uuid):
remote_pif = get_physical_pif(session, mgmt_pif)
# Find the MAC address of the management interface:
mac = session.xenapi.PIF.get_MAC(remote_pif)

"""Attempt to wake up a machine by sending Wake-On-Lan packets encapsulated within UDP datagrams
sent to the broadcast_addr."""
# A Wake-On-LAN packet contains FF:FF:FF:FF:FF:FF followed by 16 repetitions of the target MAC address
bin_payload = bytes.fromhex("F" * 12 + mac.replace(":", "") * 16)

Expand Down
2 changes: 0 additions & 2 deletions scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ endif
$(IPROG) examples/python/echo.py $(DESTDIR)$(PLUGINDIR)/echo
$(IPROG) examples/python/shell.py $(DESTDIR)$(LIBEXECDIR)/shell.py
# poweron
$(IPROG) poweron/wlan.py $(DESTDIR)$(PLUGINDIR)/wlan.py
$(IPROG) poweron/wlan.py $(DESTDIR)$(PLUGINDIR)/wake-on-lan
$(IPROG) poweron/DRAC.py $(DESTDIR)$(PLUGINDIR)/DRAC.py
$(IPROG) poweron/power-on.py $(DESTDIR)$(PLUGINDIR)/power-on-host
# YUM plugins
Expand Down

0 comments on commit 5264939

Please sign in to comment.