예제 #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
예제 #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
예제 #3
0
파일: test_http.py 프로젝트: 4i60r/ralph
 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')
예제 #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')
예제 #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
예제 #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
예제 #7
0
파일: test_http.py 프로젝트: smagowr/ralph
 def test_guess_family_empty(self):
     family = guess_family({}, '')
     self.assertEqual(family, 'Unspecified')
예제 #8
0
 def test_guess_family_dell_when_data_from_dell_server(self):
     headers = {}
     family = guess_family(headers, DATA)
     self.assertEqual(family, 'Dell')
예제 #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')
예제 #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')
예제 #11
0
 def test_guess_family_f5(self):
     family = guess_family({'Server': 'Apache'}, '<title>BIG-IP</title>')
     self.assertEqual(family, 'F5')
예제 #12
0
 def test_guess_family_sun(self):
     family = guess_family({'Server': 'Sun-ILOM-Web-Server'}, '')
     self.assertEqual(family, 'Sun')
예제 #13
0
 def test_guess_family_empty(self):
     family = guess_family({}, '')
     self.assertEqual(family, 'Unspecified')
예제 #14
0
파일: test_http.py 프로젝트: smagowr/ralph
 def test_guess_family_sun(self):
     family = guess_family({'Server': 'Sun-ILOM-Web-Server'}, '')
     self.assertEqual(family, 'Sun')
예제 #15
0
파일: test_http.py 프로젝트: 4i60r/ralph
 def test_guess_family_dell_when_data_from_dell_server(self):
     headers = {}
     family = guess_family(headers, DATA)
     self.assertEqual(family, 'Dell')
예제 #16
0
파일: test_http.py 프로젝트: smagowr/ralph
 def test_guess_family_f5(self):
     family = guess_family({'Server': 'Apache'}, '<title>BIG-IP</title>')
     self.assertEqual(family, 'F5')
예제 #17
0
파일: test_http.py 프로젝트: smagowr/ralph
 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')
예제 #18
0
파일: test_http.py 프로젝트: smagowr/ralph
 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')