def test_wrapper_processing(self):
     """
     Tests that the wrapper can process a valid mib file without errors.
     """
     result = mib2pysnmp('conpot/tests/data/VOGON-POEM-MIB.mib')
     self.assertTrue('mibBuilder.exportSymbols("VOGON-POEM-MIB"' in result,
                     'mib2pysnmp did not generate the expected output. Output: {0}'.format(result))
示例#2
0
 def test_wrapper_processing(self):
     """
     Tests that the wrapper can process a valid mib file without errors.
     """
     tmpdir = tempfile.mkdtemp()
     result = mib2pysnmp(self.mib_file, tmpdir)
     self.assertTrue(result and check_content(os.path.join(tmpdir, 'VOGON-POEM-MIB.py')),
                     'mib2pysnmp2 did not generate the expected output.')
示例#3
0
 def test_wrapper_processing(self):
     """
     Tests that the wrapper can process a valid mib file without errors.
     """
     tmpdir = tempfile.mkdtemp()
     result = mib2pysnmp(self.mib_file, tmpdir)
     self.assertTrue(result and self.check_content(os.path.join(tmpdir, 'VOGON-POEM-MIB.py')),
                     'mib2pysnmp2 did not generate the expected output.')
 def test_wrapper_processing(self):
     """
     Tests that the wrapper can process a valid mib file without errors.
     """
     result = mib2pysnmp('conpot/tests/data/VOGON-POEM-MIB.mib')
     self.assertTrue(
         'mibBuilder.exportSymbols("VOGON-POEM-MIB"' in result,
         'mib2pysnmp did not generate the expected output. Output: {0}'.
         format(result))
示例#5
0
    def test_wrapper_output(self):
        """
        Tests that the wrapper generates output that can be consumed by the command responder.
        """
        tmpdir = None

        try:
            result = None
            tmpdir = tempfile.mkdtemp()

            if mib2pysnmp(self.mib_file, tmpdir):
                cmd_responder = command_responder.CommandResponder('', 0, [tmpdir])
                cmd_responder.snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.loadModules('VOGON-POEM-MIB')
                result = cmd_responder._get_mibSymbol('VOGON-POEM-MIB', 'poemNumber')

            self.assertIsNotNone(result, 'The expected MIB (VOGON-POEM-MIB) could not be loaded.')
        finally:
            shutil.rmtree(tmpdir)
示例#6
0
    def test_wrapper_output(self):
        """
        Tests that the wrapper generates output that can be consumed by the command responder.
        """
        tmpdir = None

        try:
            result = None
            tmpdir = tempfile.mkdtemp()

            if mib2pysnmp(self.mib_file, tmpdir):
                cmd_responder = command_responder.CommandResponder('', 0, [tmpdir])
                cmd_responder.snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.loadModules('VOGON-POEM-MIB')
                result = cmd_responder._get_mibSymbol('VOGON-POEM-MIB', 'poemNumber')

            self.assertIsNotNone(result, 'The expected MIB (VOGON-POEM-MIB) could not be loaded.')
        finally:
            shutil.rmtree(tmpdir)
示例#7
0
    def test_wrapper_output(self):
        """
        Tests that the wrapper generates output that can be consumed by the command responder.
        """
        tmpdir = None
        try:
            tmpdir = tempfile.mkdtemp()
            result = mib2pysnmp("conpot/tests/data/VOGON-POEM-MIB.mib")

            with open(os.path.join(tmpdir, "VOGON-POEM-MIB" + ".py"), "w") as output_file:
                output_file.write(result)

            cmd_responder = command_responder.CommandResponder("", 0, [tmpdir])
            cmd_responder.snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.loadModules("VOGON-POEM-MIB")
            result = cmd_responder._get_mibSymbol("VOGON-POEM-MIB", "poemNumber")

            self.assertIsNotNone(result, "The expected MIB (VOGON-POEM-MIB) could not be loaded.")
        finally:
            shutil.rmtree(tmpdir)
    def test_wrapper_output(self):
        """
        Tests that the wrapper generates output that can be consumed by the command responder.
        """
        tmpdir = None
        try:
            tmpdir = tempfile.mkdtemp()
            result = mib2pysnmp('conpot/tests/data/VOGON-POEM-MIB.mib')

            with open(os.path.join(tmpdir, 'VOGON-POEM-MIB' + '.py'),
                      'w') as output_file:
                output_file.write(result)

            cmd_responder = command_responder.CommandResponder('', 0, [tmpdir])
            cmd_responder.snmpEngine.msgAndPduDsp.mibInstrumController.mibBuilder.loadModules(
                'VOGON-POEM-MIB')
            result = cmd_responder._get_mibSymbol('VOGON-POEM-MIB',
                                                  'poemNumber')

            self.assertIsNotNone(
                result,
                'The expected MIB (VOGON-POEM-MIB) could not be loaded.')
        finally:
            shutil.rmtree(tmpdir)