Example #1
0
def http_ibm_system_x(**kwargs):
    if USER is None or PASSWORD is None:
        return False, 'no credentials.', kwargs
    ip = str(kwargs['ip'])
    try:
        headers, document = get_http_info(ip)
        family = guess_family(headers, document)
        if family != 'IBM System X':
            return False, 'not identified.', kwargs
        name = run_http_ibm_system_x(ip)
        return True, name, kwargs
    except (network.Error, Error) as e:
        return False, str(e), kwargs
Example #2
0
def http_ibm_system_x(**kwargs):
    if USER is None or PASSWORD is None:
        return False, 'no credentials.', kwargs
    ip = str(kwargs['ip'])
    try:
        headers, document = get_http_info(ip)
        family = guess_family(headers, document)
        if family != 'IBM System X':
            return False, 'not identified.', kwargs
        name = run_http_ibm_system_x(ip)
        return True, name, kwargs
    except (network.Error, Error) as e:
        return False, str(e), kwargs
Example #3
0
 def test_guess_family_xen_when_data_from_xen(self):
     headers = {}
     family = guess_family(headers, """
         <html>
             <title>XenServer 6.5.0</title>
             <head>
             </head>
             <body>
               <p/>Citrix Systems, Inc. XenServer 6.5.0
               <p/><a href="XenCenter.iso">XenCenter CD image</a>
               <p/><a href="XenCenterSetup.exe">XenCenter installer</a>
             </body>
         </html>"""
     )
     self.assertEqual(family, 'Xen')
Example #4
0
 def test_guess_family_xen_when_data_from_xen(self):
     headers = {}
     family = guess_family(
         headers, """
         <html>
             <title>XenServer 6.5.0</title>
             <head>
             </head>
             <body>
               <p/>Citrix Systems, Inc. XenServer 6.5.0
               <p/><a href="XenCenter.iso">XenCenter CD image</a>
               <p/><a href="XenCenterSetup.exe">XenCenter installer</a>
             </body>
         </html>""")
     self.assertEqual(family, 'Xen')
Example #5
0
def scan_address(ip_address, **kwargs):
    user = SETTINGS.get('user')
    password = SETTINGS.get('password')
    messages = []
    result = get_base_result_template('http_ibm_system_x', messages)
    if not user or not password:
        raise NotConfiguredError(
            'Not configured. Set IBM_SYSTEM_X_USER and IBM_SYSTEM_X_PASSWORD '
            'in your configuration file.', )
    headers, document = get_http_info(ip_address)
    family = guess_family(headers, document)
    if family != 'IBM System X':
        raise NoMatchError('It is not IBM System X device.')
    result.update({
        'status': 'success',
        'device': _http_ibm_system_x(ip_address, user, password),
    })
    return result
Example #6
0
def scan_address(ip_address, **kwargs):
    user = SETTINGS.get('user')
    password = SETTINGS.get('password')
    messages = []
    result = get_base_result_template('http_ibm_system_x', messages)
    if not user or not password:
        raise NotConfiguredError(
            'Not configured. Set IBM_SYSTEM_X_USER and IBM_SYSTEM_X_PASSWORD '
            'in your configuration file.',
        )
    headers, document = get_http_info(ip_address)
    family = guess_family(headers, document)
    if family != 'IBM System X':
        raise NoMatchError('It is not IBM System X device.')
    result.update({
        'status': 'success',
        'device': _http_ibm_system_x(ip_address, user, password),
    })
    return result
Example #7
0
 def test_guess_family_empty(self):
     family = guess_family({}, '')
     self.assertEqual(family, 'Unspecified')
Example #8
0
 def test_guess_family_dell_when_data_from_dell_server(self):
     headers = {}
     family = guess_family(headers, DATA)
     self.assertEqual(family, 'Dell')
Example #9
0
 def test_guess_family_dell(self):
     test_string = 'top.document.location.href = "/sclogin.html?console"'
     family = guess_family({'Server': 'Mbedthis-Appweb/2.4.2'},
                                test_string)
     self.assertEqual(family, 'Dell')
Example #10
0
 def test_guess_family_juniper(self):
     test_string = '<title>Log In - Juniper Web Device Manager</title>'
     family = guess_family({'Server': 'Mbedthis-Appweb/2.4.2'},
                                test_string)
     self.assertEqual(family, 'Juniper')
Example #11
0
 def test_guess_family_f5(self):
     family = guess_family({'Server': 'Apache'}, '<title>BIG-IP</title>')
     self.assertEqual(family, 'F5')
Example #12
0
 def test_guess_family_sun(self):
     family = guess_family({'Server': 'Sun-ILOM-Web-Server'}, '')
     self.assertEqual(family, 'Sun')
Example #13
0
 def test_guess_family_empty(self):
     family = guess_family({}, '')
     self.assertEqual(family, 'Unspecified')
Example #14
0
 def test_guess_family_sun(self):
     family = guess_family({'Server': 'Sun-ILOM-Web-Server'}, '')
     self.assertEqual(family, 'Sun')
Example #15
0
 def test_guess_family_dell_when_data_from_dell_server(self):
     headers = {}
     family = guess_family(headers, DATA)
     self.assertEqual(family, 'Dell')
Example #16
0
 def test_guess_family_f5(self):
     family = guess_family({'Server': 'Apache'}, '<title>BIG-IP</title>')
     self.assertEqual(family, 'F5')
Example #17
0
 def test_guess_family_dell(self):
     test_string = 'top.document.location.href = "/sclogin.html?console"'
     family = guess_family({'Server': 'Mbedthis-Appweb/2.4.2'}, test_string)
     self.assertEqual(family, 'Dell')
Example #18
0
 def test_guess_family_juniper(self):
     test_string = '<title>Log In - Juniper Web Device Manager</title>'
     family = guess_family({'Server': 'Mbedthis-Appweb/2.4.2'}, test_string)
     self.assertEqual(family, 'Juniper')