Exemple #1
0
def test_complex_filter_invalid_and_attribute(
        cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg':
        'parameters are mutually exclusive: attribute|and|or, and|value found in resources -> complex_filter',
        'failed': True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile',
            'resources': {
                'complex_filter': {
                    'and': [{
                        'attribute': 'FOO',
                        'value': 'BAR'
                    }, {
                        'attribute': 'BAT',
                        'operator': '==',
                        'value': 'BAZ'
                    }],
                    'attribute':
                    'FOO2',
                    'value':
                    'BAR2'
                }
            }
        })
Exemple #2
0
def test_complex_filter_operator_letters(
        cmci_module):  # type: (CMCITestHelper) -> None
    records = [{'name': 'bat', 'dsname': 'STEWF.BLOP.BLIP'}]
    cmci_module.stub_records('GET',
                             'cicslocalfile',
                             records,
                             scope=SCOPE,
                             parameters='?CRITERIA=%28FOO%3E%27BAR%27%29')

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicslocalfile/CICSEX56/IYCWEMW2?CRITERIA=%28FOO%3E%27BAR%27%29',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile',
            'resources': {
                'complex_filter': {
                    'attribute': 'FOO',
                    'operator': 'GT',
                    'value': 'BAR'
                }
            }
        })
Exemple #3
0
def test_filter_multi(cmci_module):  # type: (CMCITestHelper) -> None
    records = [{'name': 'bat', 'dsname': 'STEWF.BLOP.BLIP'}]
    filters = OrderedDict({})
    filters['GOO'] = 'LAR'
    filters['FOO'] = 'BAR'

    cmci_module.stub_records(
        'GET',
        'cicslocalfile',
        records,
        scope=SCOPE,
        parameters=
        '?CRITERIA=%28GOO%3D%27LAR%27%29%20AND%20%28FOO%3D%27BAR%27%29')

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicslocalfile/CICSEX56/IYCWEMW2?CRITERIA=%28GOO%3D%27LAR%27%29%20AND%20%28FOO%3D%27BAR%27%29',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile',
            'resources': {
                'filter': filters
            }
        })
Exemple #4
0
def test_query_criteria_complex_filter_no_value(cmci_module):
    cmci_module.expect({
        'msg':
        'parameters are required together: attribute, value found in resources -> complex_filter -> and',
        'failed': True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile',
            'resources': {
                'complex_filter': {
                    'and': [{
                        'attribute': 'FOO'
                    }, {
                        'attribute': 'BAR',
                        'value': 'BOO'
                    }]
                }
            }
        })
Exemple #5
0
def test_auth(cmci_module):  # type: (CMCITestHelper) -> None
    records = [{
        'name': 'bat',
        'dsname': 'STEWF.BLOP.BLIP'
    }, {
        'name': 'bing',
        'dsname': 'STEWF.BAT.BAZ'
    }]
    cmci_module.stub_records(
        'GET',
        'cicslocalfile',
        records,
        scope=SCOPE,
        request_headers={'authorization': 'Basic Zm9vOmJhcg=='},
        scheme='https')

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicslocalfile/CICSEX56/IYCWEMW2',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'cmci_user': '******',
            'cmci_password': '******',
            'context': CONTEXT,
            'scope': SCOPE,
            'type': 'cicslocalfile'
        })
Exemple #6
0
def test_csd_install(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(name='bar', bundledir='/u/bundles/bloop', csdgroup='bat')
    cmci_module.stub_records('PUT',
                             'cicsdefinitionbundle',
                             records=[record],
                             scope='IYCWEMW2',
                             parameters='?PARAMETER=CSDGROUP%28%2A%29',
                             additional_matcher=body_matcher(
                                 od(('request',
                                     od(('action', od(
                                         ('@name', 'CSDINSTALL'))))))))

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionbundle/CICSEX56/IYCWEMW2?PARAMETER=CSDGROUP%28%2A%29',
            record, '<request><action name="CSDINSTALL"></action></request>'))

    cmci_module.run(
        cmci_install, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicsdefinitionbundle',
            'location': 'CSD',
            'resources': {
                'parameter': 'CSDGROUP(*)'
            }
        })
Exemple #7
0
def test_bas_install(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(
        name='bar',
        bundledir='/u/bundles/bloop',
        csdgroup='bat'
    )
    cmci_module.stub_records(
        'PUT',
        'cicsdefinitionbundle',
        [record],
        additional_matcher=body_matcher(od(
            ('request', od(
                ('action', od(
                    ('@name', 'INSTALL')
                ))
            ))
        ))
    )

    cmci_module.expect(ok_result(
        'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsdefinitionbundle/CICSEX56/',
        record,
        '<request><action name="INSTALL"></action></request>'
    ))

    cmci_module.run(cmci_action, {
        'cmci_host': HOST,
        'cmci_port': PORT,
        'context': CONTEXT,
        'type': 'cicsdefinitionbundle',
        'action_name': 'INSTALL'
    })
Exemple #8
0
def test_ok_context_scope_jvmserver_header(
        cmci_module):  # type: (CMCITestHelper) -> None
    records = [{
        'name': 'bat',
        'dsname': 'STEWF.BLOP.BLIP'
    }, {
        'name': 'bing',
        'dsname': 'STEWF.BAT.BAZ'
    }]

    cmci_module.stub_records(
        'GET',
        'cicslocalfile',
        records,
        scope=SCOPE,
        headers={
            # JVM server returns a content type with the charset embedded
            'Content-Type': 'application/xml;charset=UTF-8'
        })

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicslocalfile/CICSEX56/IYCWEMW2',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile'
        })
Exemple #9
0
def test_non_ok_delete(cmci_module):
    cmci_module.stub_non_ok_delete(
        'cicsresourcedescription',
        3,
        parameters="?CRITERIA=%28RESDESC%3D%27BASICB1%27%29")

    cmci_module.expect(
        fail_result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsresourcedescription/'
            'CICSEX56/?CRITERIA=%28RESDESC%3D%27BASICB1%27%29', 'TABLEERROR',
            1038, 'DATAERROR', 1361,
            'CMCI request failed with response "TABLEERROR" reason "DATAERROR"'
        ))

    cmci_module.run(
        cmci_delete, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'type': 'cicsresourcedescription',
            'resources': {
                'filter': {
                    'RESDESC': 'BASICB1'
                }
            }
        })
Exemple #10
0
def test_query_criteria(cmci_module):  # type: (CMCITestHelper) -> None
    records = [{'name': 'bat', 'dsname': 'STEWF.BLOP.BLIP'}]
    cmci_module.stub_records('GET',
                             'cicslocalfile',
                             records,
                             scope=SCOPE,
                             parameters='?CRITERIA=FOO%3DBAR')

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicslocalfile/CICSEX56/IYCWEMW2?CRITERIA=FOO%3DBAR',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile',
            'resources': {
                'criteria': 'FOO=BAR'
            }
        })
Exemple #11
0
def test_delete_criteria_parameter(
        cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.stub_delete(
        'cicsdefinitionbundle',
        1,
        parameters='?CRITERIA=%28FOO%3D%27BAR%27%29&PARAMETER=CSDGROUP%28%2A%29'
    )

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionbundle/CICSEX56/?CRITERIA=%28FOO%3D%27BAR%27%29&PARAMETER=CSDGROUP%28%2A%29',
            1))

    cmci_module.run(
        cmci_delete, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'type': 'cicsdefinitionbundle',
            'resources': {
                'filter': {
                    'FOO': 'BAR'
                },
                'get_parameters': [{
                    'name': 'CSDGROUP',
                    'value': '*'
                }]
            }
        })
Exemple #12
0
def test_ok_context_scope_http(cmci_module):  # type: (CMCITestHelper) -> None
    records = [{
        'name': 'bat',
        'dsname': 'STEWF.BLOP.BLIP'
    }, {
        'name': 'bing',
        'dsname': 'STEWF.BAT.BAZ'
    }]
    cmci_module.stub_records('GET',
                             'cicslocalfile',
                             records,
                             scope=SCOPE,
                             scheme='http')

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicslocalfile/CICSEX56/IYCWEMW2',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicslocalfile',
            'scheme': 'http'
        })
Exemple #13
0
def test_query_parameter_criteria(
        cmci_module):  # type: (CMCITestHelper) -> None
    records = [{'name': 'bat', 'dsname': 'STEWF.BLOP.BLIP'}]

    cmci_module.stub_records(
        'GET',
        'cicsdefinitionfile',
        records,
        scope=SCOPE,
        parameters='?CRITERIA=%28FOO%3D%27BAR%27%29&PARAMETER=CSDGROUP%28%2A%29'
    )

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionfile/CICSEX56/IYCWEMW2?CRITERIA=%28FOO%3D%27BAR%27%29&PARAMETER=CSDGROUP%28%2A%29',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': 'IYCWEMW2',
            'type': 'cicsdefinitionfile',
            'resources': {
                'get_parameters': [{
                    'name': 'CSDGROUP',
                    'value': '*'
                }],
                'filter': {
                    'FOO': 'BAR'
                }
            }
        })
Exemple #14
0
def test_install_csd_criteria_parameter(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(
        changeagent='CSDAPI',
        changeagrel='0730',
        csdgroup='DUMMY',
        name='DUMMY'
    )
    cmci_module.stub_records(
        'PUT',
        'cicsdefinitionprogram',
        [record],
        scope=SCOPE,
        parameters='?CRITERIA=%28NAME%3D%27DUMMY%27%29%20AND%20%28DEFVER%3D%270%27%29%20AND'
                   '%20%28CSDGROUP%3D%27DUMMY%27%29&PARAMETER=CSDGROUP%28DUMMY%29',

        additional_matcher=body_matcher(od(
            ('request', od(
                ('action', od(
                    ('@name', 'CSDINSTALL')
                ))
            ))
        ))
    )

    cmci_module.expect(ok_result(
        'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsdefinitionprogram/'
        'CICSEX56/IYCWEMW2?CRITERIA=%28NAME%3D%27DUMMY%27%29%20AND%20%28DEFVER%3D%270%27%29%20AND'
        '%20%28CSDGROUP%3D%27DUMMY%27%29&PARAMETER=CSDGROUP%28DUMMY%29',
        record,
        '<request><action name="CSDINSTALL"></action></request>'
    ))
    cmci_module.run(cmci_action, {
        'cmci_host': HOST,
        'cmci_port': PORT,
        'context': CONTEXT,
        'scope': SCOPE,
        'type': 'cicsdefinitionprogram',
        'action_name': 'CSDINSTALL',
        'resources': {
            'complex_filter': {
                'and': [
                    {
                        'attribute': 'NAME',
                        'value': 'DUMMY'
                    }, {
                        'attribute': 'DEFVER',
                        'value': '0'
                    }, {
                        'attribute': 'CSDGROUP',
                        'value': 'DUMMY'
                    }
                ]
            },
            'get_parameters': [{'name': 'CSDGROUP', 'value': 'DUMMY'}]
        }
    })
Exemple #15
0
def test_csd_update(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(changeagent='CSDAPI',
                  changeagrel='0730',
                  csdgroup='DUMMY',
                  description='new description',
                  name='DUMMY')
    cmci_module.stub_records(
        'PUT',
        'cicsdefinitionprogram', [record],
        scope=SCOPE,
        parameters=
        '?CRITERIA=%28NAME%3D%27DUMMY%27%29&PARAMETER=CSDGROUP%28DUMMY%29',
        additional_matcher=body_matcher(
            od(('request',
                od(('update',
                    od(('parameter', od(('@name', 'CSD'))),
                       ('attributes', od(
                           ('@description', 'new description'))))))))))

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsdefinitionprogram'
            '/CICSEX56/IYCWEMW2?CRITERIA=%28NAME%3D%27DUMMY%27%29&PARAMETER=CSDGROUP%28DUMMY%29',
            record, '<request><update>'
            '<parameter name="CSD"></parameter>'
            '<attributes description="new description"></attributes>'
            '</update></request>'))

    cmci_module.run(
        cmci_update, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': SCOPE,
            'type': 'cicsdefinitionprogram',
            'update_parameters': [{
                'name': 'CSD'
            }],
            'attributes': {
                'description': 'new description'
            },
            'resources': {
                'filter': {
                    'NAME': 'DUMMY'
                },
                'get_parameters': [{
                    'name': 'CSDGROUP',
                    'value': 'DUMMY'
                }]
            }
        })
Exemple #16
0
def test_bas_install_params(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(
        name='bar',
        bundledir='/u/bundles/bloop',
        csdgroup='bat'
    )

    cmci_module.stub_records(
        'PUT',
        'cicsdefinitionbundle',
        [record],
        additional_matcher=body_matcher(od(
            ('request', od(
                ('action', od(
                    ('@name', 'INSTALL'),
                    ('parameter', [
                        od(
                            ('@name', 'FORCEINS'),
                            ('@value', 'NO')
                        ),
                        od(
                            ('@name', 'USAGE'),
                            ('@value', 'LOCAL')
                        )
                    ])
                ))
            ))
        ))
    )

    cmci_module.expect(ok_result(
        'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsdefinitionbundle/CICSEX56/',
        record,
        '<request><action name="INSTALL">'
        '<parameter name="FORCEINS" value="NO"></parameter>'
        '<parameter name="USAGE" value="LOCAL"></parameter>'
        '</action></request>'
    ))

    cmci_module.run(cmci_action, {
        'cmci_host': HOST,
        'cmci_port': PORT,
        'context': CONTEXT,
        'type': 'cicsdefinitionbundle',
        'action_name': 'INSTALL',
        'action_parameters': [
            {'name': 'FORCEINS', 'value': 'NO'},
            {'name': 'USAGE', 'value': 'LOCAL'}
        ]
    })
Exemple #17
0
def test_csd_create(cmci_module):  # type: (CMCITestHelper) -> None
    record = OrderedDict({})
    record['csdgroup'] = 'bat'
    record['name'] = 'bar'
    record['bundledir'] = '/u/bundles/bloop'

    cmci_module.stub_records(
        'POST',
        'cicsdefinitionbundle',
        [record],
        scope='IYCWEMW2',
        additional_matcher=body_matcher(od(
            ('request', od(
                ('create', od(
                    ('parameter', od(
                        ('@name', 'CSD')
                    )),
                    ('attributes', od(
                        ('@csdgroup', 'bat'),
                        ('@name', 'bar'),
                        ('@bundledir', '/u/bundles/bloop')
                    ))
                ))
            ))
        ))
    )

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionbundle/CICSEX56/IYCWEMW2',
            record,
            '<request><create>'
            '<parameter name="CSD"></parameter>'
            '<attributes csdgroup="bat" name="bar" bundledir="/u/bundles/bloop"></attributes>'
            '</create></request>'
        )
    )

    cmci_module.run(cmci_create, dict(
        cmci_host=HOST,
        cmci_port=PORT,
        context=CONTEXT,
        scope='IYCWEMW2',
        type='cicsdefinitionbundle',
        create_parameters=[dict(
            name='CSD'
        )],
        attributes=record
    ))
Exemple #18
0
def test_bas_create(cmci_module):  # type: (CMCITestHelper) -> None
    record = OrderedDict({})
    record['AUTOINST'] = 'NO'
    record['RGSCOPE'] = 'BAS1'
    record['RESDESC'] = 'BASICB11'

    cmci_module.stub_records(
        'POST',
        'cicsdefinitionbundle',
        [record],
        scope='IYCWEMW2',
        additional_matcher=body_matcher(od(
            ('request', od(
                ('create', od(
                    ('parameter', od(
                        ('@name', 'BAS')
                    )),
                    ('attributes', od(
                        ('@AUTOINST', 'NO'),
                        ('@RGSCOPE', 'BAS1'),
                        ('@RESDESC', 'BASICB11')
                    ))
                ))
            ))
        ))
    )

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionbundle/CICSEX56/IYCWEMW2',
            record,
            '<request><create>'
            '<parameter name="BAS"></parameter>'
            '<attributes AUTOINST="NO" RGSCOPE="BAS1" RESDESC="BASICB11"></attributes>'
            '</create></request>'
        )
    )

    cmci_module.run(cmci_create, dict(
        cmci_host=HOST,
        cmci_port=PORT,
        context=CONTEXT,
        scope='IYCWEMW2',
        type='cicsdefinitionbundle',
        create_parameters=[dict(
            name='BAS'
        )],
        attributes=record
    ))
def test_delete_context(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.stub_delete('cicsdefinitionbundle', 1)

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsdefinitionbundle/CICSEX56/',
            1))

    cmci_module.run(
        cmci_delete, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'type': 'cicsdefinitionbundle'
        })
Exemple #20
0
def test_invalid_security(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg':
        'value of security_type must be one of: none, basic, certificate, got: yes',
        'failed': True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': '100.99.99.199',
            'cmci_port': '10080',
            'context': 'iyk3z0r9',
            'scope': 'iyk3z0r8',
            'security_type': 'yes',
            'type': 'cicslocalfile'
        })
Exemple #21
0
def test_invalid_host(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg':
        'Parameter "cmci_host" with value "^*.99.99.199" was not valid. Expected an IP address or host name.',
        'changed': False,
        'failed': True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': '^*.99.99.199',
            'cmci_port': '10080',
            'context': 'iyk3z0r9',
            'scope': 'iyk3z0r8',
            'type': 'cicslocalfile'
        })
Exemple #22
0
def test_cert_key_required_together(
        cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg': 'parameters are required together: cmci_cert, cmci_key',
        'failed': True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'cmci_cert': 'foo',
            'context': CONTEXT,
            'scope': SCOPE,
            'type': 'cicslocalfile'
        })
Exemple #23
0
def test_invalid_port_high(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg':
        'Parameter "cmci_port" with value "65536" was not valid.  Expected a port number 0-65535.',
        'changed': False,
        'failed': True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': '100.99.99.199',
            'cmci_port': 65536,
            'context': 'iyk3z0r9',
            'scope': 'iyk3z0r8',
            'type': 'cicslocalfile'
        })
Exemple #24
0
def test_invalid_port_type(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg':
        "argument cmci_port is of type <class 'str'> and we were unable to "
        "convert to int: invalid literal for int() with base 10: '^%^080'",
        'failed':
        True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': '100.99.99.199',
            'cmci_port': '^%^080',
            'context': 'iyk3z0r9',
            'scope': 'iyk3z0r8',
            'type': 'cicslocalfile'
        })
Exemple #25
0
def test_non_ok_response(cmci_module):
    record = dict(
        name='bar',
        bundledir='/u/bundles/bloop',
        csdgroup='bat'
    )

    cmci_module.stub_non_ok_records(
        'PUT',
        'cicsresourcedescription',
        record,
        scope=SCOPE,
        parameters="?CRITERIA=%28RESDESC%3D%27BASICB1%27%29",
        additional_matcher=body_matcher(od(
            ('request', od(
                ('action', od(
                    ('@name', 'INSTALL')
                ))
            ))
        ))
    )

    cmci_module.expect(fail_result(
        'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsresourcedescription/'
        'CICSEX56/IYCWEMW2?CRITERIA=%28RESDESC%3D%27BASICB1%27%29',
        '<request><action name="INSTALL"></action></request>',
        'TABLEERROR',
        1038,
        'DATAERROR',
        1361,
        'CMCI request failed with response "TABLEERROR" reason "DATAERROR"'
    ))

    cmci_module.run(cmci_action, {
        'cmci_host': HOST,
        'cmci_port': PORT,
        'context': CONTEXT,
        'scope': SCOPE,
        'type': 'cicsresourcedescription',
        'action_name': 'INSTALL',
        'resources': {
            'filter': {
                'RESDESC': 'BASICB1'
            }
        }
    })
Exemple #26
0
def test_ok_context_record_count(
        cmci_module):  # type: (CMCITestHelper) -> None
    records = [{'name': 'bat', 'dsname': 'STEWF.BLOP.BLIP'}]

    cmci_module.stub_records('GET', 'cicslocalfile', records, record_count=1)

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicslocalfile/CICSEX56///1',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'record_count': 1,
            'type': 'cicslocalfile'
        })
Exemple #27
0
def test_invalid_scope(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.expect({
        'msg':
        'Parameter "scope" with value "&^iyk3z0r8" was not valid. Expected a CPSM scope name. CPSM scope '
        'names are max 8 characters. Valid characters are A-Z a-z 0-9.',
        'changed':
        False,
        'failed':
        True
    })

    cmci_module.run(
        cmci_get, {
            'cmci_host': '100.99.99.199',
            'cmci_port': '10080',
            'context': 'iyk3z0r9',
            'scope': '&^iyk3z0r8',
            'type': 'cicslocalfile'
        })
Exemple #28
0
def test_bas_query(cmci_module):  # type: (CMCITestHelper) -> None
    records = [{
        'defname': 'DUMMY1',
        'deftype': 'PROGDEF',
        'ingtype': 'PGMINGRP',
        'resgroup': 'BASGRP1'
    }, {
        'defname': 'DUMMY2',
        'deftype': 'TRANDEF',
        'ingtype': 'PGMINGRP',
        'resgroup': 'BASGRP1'
    }, {
        'defname': 'DUMMY3',
        'deftype': 'LIBDEF',
        'ingtype': 'PGMINGRP',
        'resgroup': 'BASGRP1'
    }]

    cmci_module.stub_records(
        'GET',
        'cicsresourceingroup',
        records,
        parameters='?CRITERIA=%28RESGROUP%3D%27BASGRP1%27%29')

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsresourceingroup/CICSEX56/?CRITERIA=%28RESGROUP%3D%27BASGRP1%27%29',
            records=records))

    cmci_module.run(
        cmci_get, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'resources': {
                'filter': {
                    'RESGROUP': 'BASGRP1'
                }
            },
            'type': 'cicsresourceingroup'
        })
def test_delete_parameter(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.stub_delete('cicsdefinitionbundle',
                            1,
                            parameters='?PARAMETER=CSDGROUP%28%2A%29')

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionbundle/CICSEX56/?PARAMETER=CSDGROUP%28%2A%29', 1))

    cmci_module.run(
        cmci_delete, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'type': 'cicsdefinitionbundle',
            'resources': {
                'parameter': 'CSDGROUP(*)'
            }
        })
def test_delete_criteria(cmci_module):  # type: (CMCITestHelper) -> None
    cmci_module.stub_delete('cicsdefinitionbundle',
                            1,
                            parameters='?CRITERIA=FOO%3DBAR')

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
            'cicsdefinitionbundle/CICSEX56/?CRITERIA=FOO%3DBAR', 1))

    cmci_module.run(
        cmci_delete, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'type': 'cicsdefinitionbundle',
            'resources': {
                'criteria': 'FOO=BAR'
            }
        })