本文整理汇总了Python中jnpr.junos.utils.sw.SW.pkgaddISSU方法的典型用法代码示例。如果您正苦于以下问题:Python SW.pkgaddISSU方法的具体用法?Python SW.pkgaddISSU怎么用?Python SW.pkgaddISSU使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jnpr.junos.utils.sw.SW
的用法示例。
在下文中一共展示了SW.pkgaddISSU方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestSW
# 需要导入模块: from jnpr.junos.utils.sw import SW [as 别名]
# 或者: from jnpr.junos.utils.sw.SW import pkgaddISSU [as 别名]
#.........这里部分代码省略.........
def test_sw_pkgadd(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.pkgadd(package))
@patch('jnpr.junos.Device.execute')
def test_sw_install_issu(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.install(package, issu=True, no_copy=True))
@patch('jnpr.junos.Device.execute')
def test_sw_install_nssu(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.install(package, nssu=True, no_copy=True))
@patch('jnpr.junos.Device.execute')
def test_sw_install_issu_nssu_both_error(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertRaises(TypeError, self.sw.install, package,
nssu=True, issu=True)
@patch('jnpr.junos.Device.execute')
def test_sw_install_issu_single_re_error(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.sw._multi_RE = False
self.assertRaises(TypeError, self.sw.install, package,
nssu=True, issu=True)
@patch('jnpr.junos.Device.execute')
def test_sw_pkgaddISSU(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.pkgaddISSU(package))
@patch('jnpr.junos.Device.execute')
def test_sw_pkgaddNSSU(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.pkgaddNSSU(package))
@patch('jnpr.junos.Device.execute')
def test_sw_pkgadd_pkg_set(self, mock_execute):
mock_execute.side_effect = self._mock_manager
pkg_set = ['abc.tgz', 'pqr.tgz']
self.sw._mixed_VC = True
self.sw.pkgadd(pkg_set)
self.assertEqual([i.text for i in
mock_execute.call_args[0][0].findall('set')],
pkg_set)
@patch('jnpr.junos.Device.execute')
def test_sw_validate(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'package.tgz'
self.assertTrue(self.sw.validate(package))
@patch('jnpr.junos.Device.execute')
def test_sw_validate_issu(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'package.tgz'
self.assertTrue(self.sw.validate(package, issu=True))
示例2: TestSW
# 需要导入模块: from jnpr.junos.utils.sw import SW [as 别名]
# 或者: from jnpr.junos.utils.sw.SW import pkgaddISSU [as 别名]
#.........这里部分代码省略.........
def test_sw_install_nssu(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.install(package, nssu=True, no_copy=True))
@patch('jnpr.junos.Device.execute')
def test_sw_install_issu_nssu_both_error(self, mock_execute):
mock_execute.side_effect = self._mock_manager
try:
self.sw.install('test.tgz', issu=True, nssu=True)
except TypeError as ex:
self.assertEqual(
str(ex),
'install function can either take issu or nssu not both')
@patch('jnpr.junos.Device.execute')
def test_sw_install_issu_single_re_error(self, mock_execute):
mock_execute.side_effect = self._mock_manager
self.sw._multi_RE = False
try:
self.sw.install('test.tgz', issu=True)
except TypeError as ex:
self.assertEqual(str(ex), 'ISSU/NSSU requires Multi RE setup')
@patch('jnpr.junos.Device.execute')
def test_sw_install_issu_nssu_single_re_error(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.sw._multi_RE = False
self.assertRaises(TypeError, self.sw.install, package,
nssu=True, issu=True)
@patch('jnpr.junos.Device.execute')
def test_sw_pkgaddISSU(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.pkgaddISSU(package))
@patch('jnpr.junos.Device.execute')
def test_sw_pkgaddNSSU(self, mock_execute):
mock_execute.side_effect = self._mock_manager
package = 'test.tgz'
self.assertTrue(self.sw.pkgaddNSSU(package))
@patch('jnpr.junos.Device.execute')
def test_sw_pkgadd_pkg_set(self, mock_execute):
mock_execute.side_effect = self._mock_manager
pkg_set = ['abc.tgz', 'pqr.tgz']
self.sw._mixed_VC = True
self.sw.pkgadd(pkg_set)
self.assertEqual([i.text for i in
mock_execute.call_args[0][0].findall('set')],
pkg_set)
@patch('jnpr.junos.Device.execute')
def test_sw_validate(self, mock_execute):
mock_execute.side_effect = self._mock_manager
self.assertTrue(self.sw.validate('package.tgz'))
@patch('jnpr.junos.Device.execute')
def test_sw_validate_nssu(self, mock_execute):
mock_execute.side_effect = self._mock_manager
self.sw.log = MagicMock()
# get_config returns false
self.assertFalse(self.sw.validate('package.tgz', nssu=True))
self.sw.log.assert_called_with(