forked from Uninett/nav
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Uninett#2666 from stveit/poe-juniper
Add PoE config for Juniper devices
- Loading branch information
Showing
7 changed files
with
386 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
python/nav/portadmin/napalm/templates/portadmin/junos-disable-poe.djt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
set poe interface {{ ifname }} disable |
1 change: 1 addition & 0 deletions
1
python/nav/portadmin/napalm/templates/portadmin/junos-enable-poe.djt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
delete poe interface {{ ifname }} disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import pytest | ||
from unittest.mock import Mock | ||
|
||
from nav.enterprise.ids import VENDOR_ID_JUNIPER_NETWORKS_INC | ||
from nav.models import manage | ||
from nav.portadmin.napalm.juniper import Juniper | ||
|
||
|
||
@pytest.fixture() | ||
def netbox_mock(interface1_mock, interface2_mock): | ||
"""Create netbox model mock object""" | ||
netbox = Mock() | ||
netbox.ip = '10.0.0.1' | ||
netbox.type.get_enterprise_id.return_value = VENDOR_ID_JUNIPER_NETWORKS_INC | ||
netbox.interfaces = [interface1_mock, interface2_mock] | ||
yield netbox | ||
|
||
|
||
@pytest.fixture() | ||
def profile_mock(): | ||
"""Create management profile model mock object""" | ||
profile = Mock() | ||
profile.protocol = manage.ManagementProfile.PROTOCOL_NAPALM | ||
profile.PROTOCOL_NAPALM = manage.ManagementProfile.PROTOCOL_NAPALM | ||
profile.configuration = {"driver": "mock"} | ||
yield profile | ||
|
||
|
||
@pytest.fixture() | ||
def handler_mock(netbox_mock, profile_mock): | ||
"""Create management handler mock object""" | ||
juniper = Juniper(netbox=netbox_mock) | ||
juniper._profile = profile_mock | ||
yield juniper | ||
|
||
|
||
@pytest.fixture() | ||
def interface1_mock(): | ||
interface = Mock() | ||
interface.ifname = "ge-0/0/1" | ||
interface.ifindex = 1 | ||
yield interface | ||
|
||
|
||
@pytest.fixture() | ||
def interface2_mock(): | ||
interface = Mock() | ||
interface.ifname = "ge-0/0/2" | ||
interface.ifindex = 2 | ||
yield interface |
Oops, something went wrong.