def test_defaults(self): expected_result = { 'interfaces': { 'interface': { 'Ethernet1': { 'config': { 'name': 'Ethernet1', 'description': 'Interface Ethernet1', 'mtu': 2048, 'enabled': True }, 'subinterfaces': { 'subinterface': { '0': { 'config': { 'index': 0, 'description': 'Subinterface Ethernet1.0', 'enabled': True } }, '100': { 'config': { 'index': 100, 'description': 'Subinterface Ethernet1.100', 'enabled': True } }, '900': { 'config': { 'index': 900, 'description': 'Subinterface Ethernet1.900', 'enabled': True } } } } }, 'Ethernet2': { 'config': { 'name': 'Ethernet2', 'description': 'Interface Ethernet2', 'mtu': 2048, 'enabled': True }, 'subinterfaces': { 'subinterface': { '400': { 'config': { 'index': 400, 'description': 'Subinterface Ethernet2.400', 'enabled': True } } } } } } } } ret = napalm_formula.defaults(self.model, self.defaults) self.assertEqual(ret, expected_result)
def test_defaults(self): expected_result = { "interfaces": { "interface": { "Ethernet1": { "config": { "name": "Ethernet1", "description": "Interface Ethernet1", "mtu": 2048, "enabled": True, }, "subinterfaces": { "subinterface": { "0": { "config": { "index": 0, "description": "Subinterface Ethernet1.0", "enabled": True, } }, "100": { "config": { "index": 100, "description": "Subinterface Ethernet1.100", "enabled": True, } }, "900": { "config": { "index": 900, "description": "Subinterface Ethernet1.900", "enabled": True, } }, } }, }, "Ethernet2": { "config": { "name": "Ethernet2", "description": "Interface Ethernet2", "mtu": 2048, "enabled": True, }, "subinterfaces": { "subinterface": { "400": { "config": { "index": 400, "description": "Subinterface Ethernet2.400", "enabled": True, } } } }, }, } } } ret = napalm_formula.defaults(self.model.copy(), self.defaults.copy()) self.assertEqual(ret, expected_result)
def test_defaults(set_model, set_defaults): expected_result = { "interfaces": { "interface": { "Ethernet1": { "config": { "name": "Ethernet1", "description": "Interface Ethernet1", "mtu": 2048, "enabled": True, }, "subinterfaces": { "subinterface": { "0": { "config": { "index": 0, "description": "Subinterface Ethernet1.0", "enabled": True, } }, "100": { "config": { "index": 100, "description": "Subinterface Ethernet1.100", "enabled": True, } }, "900": { "config": { "index": 900, "description": "Subinterface Ethernet1.900", "enabled": True, } }, } }, }, "Ethernet2": { "config": { "name": "Ethernet2", "description": "Interface Ethernet2", "mtu": 2048, "enabled": True, }, "subinterfaces": { "subinterface": { "400": { "config": { "index": 400, "description": "Subinterface Ethernet2.400", "enabled": True, } } } }, }, } } } with patch("salt.utils.napalm.is_proxy", MagicMock(return_value=True)): ret = napalm_formula.defaults(set_model.copy(), set_defaults.copy()) assert ret == expected_result