Beispiel #1
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'
                }
            }
        })
def test_csd_create(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(
        name='bar',
        bundledir='/u/bundles/bloop',
        csdgroup='bat'
    )
    cmci_module.stub_records(
        'POST',
        'cicsdefinitionbundle',
        [record],
        scope='IYCWEMW2',
        additional_matcher=body_matcher(od(
            ('request', od(
                ('create', od(
                    ('parameter', od(
                        ('@name', 'CSD')
                    )),
                    ('attributes', od(
                        ('@name', 'bar'),
                        ('@bundledir', '/u/bundles/bloop'),
                        ('@csdgroup', 'bat')
                    ))
                ))
            ))
        ))
    )

    cmci_module.expect({
        'changed': True,
        'request': {
            'url': 'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/'
                   'cicsdefinitionbundle/CICSEX56/IYCWEMW2',
            'method': 'POST',
            'body': '<request><create>'
                    '<parameter name="CSD"></parameter>'
                    '<attributes name="bar" bundledir="/u/bundles/bloop" csdgroup="bat"></attributes>'
                    '</create></request>'
        },
        'connect_version': '0560',
        'cpsm_reason': '',
        'cpsm_reason_code': 0,
        'cpsm_response': 'OK',
        'cpsm_response_code': 1024,
        'http_status': 'OK',
        'http_status_code': 200,
        'record_count': 1,
        'records': [record]
    })

    cmci_module.run(cmci_create, dict(
        cmci_host=HOST,
        cmci_port=PORT,
        context=CONTEXT,
        scope='IYCWEMW2',
        type='cicsdefinitionbundle',
        parameters=[dict(
            name='CSD'
        )],
        attributes=record
    ))
Beispiel #3
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(*)'
            }
        })
Beispiel #4
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
            }
        })
Beispiel #5
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'
    })
Beispiel #6
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'
        })
Beispiel #7
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'
        })
Beispiel #8
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'
        })
Beispiel #9
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'
            }
        })
Beispiel #10
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'
                }
            }
        })
Beispiel #11
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'}]
        }
    })
Beispiel #12
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'
                }]
            }
        })
Beispiel #13
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
    ))
Beispiel #14
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
    ))
Beispiel #15
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'}
        ]
    })
Beispiel #16
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'
        })
Beispiel #17
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'
        })
Beispiel #18
0
def test_bas_update(cmci_module):  # type: (CMCITestHelper) -> None
    record = dict(changeagent='CSDAPI',
                  changeagrel='0730',
                  description='new description',
                  resdesc='BASICB1')
    cmci_module.stub_records(
        'PUT',
        'cicsresourcedefinition', [record],
        scope=SCOPE,
        parameters='?CRITERIA=%28RESDESC%3D%27BASICB1%27%29',
        additional_matcher=body_matcher(
            od(('request',
                od(('update',
                    od(('attributes', od(
                        ('@description', 'new description'))))))))))

    cmci_module.expect(
        result(
            'https://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsresourcedefinition'
            '/CICSEX56/IYCWEMW2?CRITERIA=%28RESDESC%3D%27BASICB1%27%29',
            record, '<request><update>'
            '<attributes description="new description"></attributes>'
            '</update></request>'))

    cmci_module.run(
        cmci_update, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': SCOPE,
            'type': 'cicsresourcedefinition',
            'attributes': {
                'description': 'new description'
            },
            'resources': {
                'filter': {
                    'RESDESC': 'BASICB1'
                }
            }
        })
Beispiel #19
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=%28%28NAME%3DDUMMY%29+AND+%28DEFVER%3D0%29+AND+'
        '%28CSDGROUP%3DDUMMY%29%29&PARAMETER=CSDGROUP%28DUMMY%29',
        additional_matcher=body_matcher(
            od(('request', od(('action', od(('@name', 'CSDINSTALL'))))))))

    cmci_module.expect(
        result(
            'http://winmvs2c.hursley.ibm.com:26040/CICSSystemManagement/cicsdefinitionprogram/'
            'CICSEX56/IYCWEMW2?CRITERIA=%28%28NAME%3DDUMMY%29%20AND%20%28DEFVER%3D0%29%20AND'
            '%20%28CSDGROUP%3DDUMMY%29%29&PARAMETER=CSDGROUP%28DUMMY%29',
            record, '<request><action name="CSDINSTALL"></action></request>'))
    cmci_module.run(
        cmci_install, {
            'cmci_host': HOST,
            'cmci_port': PORT,
            'context': CONTEXT,
            'scope': SCOPE,
            'security_type': 'none',
            'type': 'cicsdefinitionprogram',
            'location': 'CSD',
            'resources': {
                'criteria':
                '((NAME=DUMMY) AND (DEFVER=0) AND (CSDGROUP=DUMMY))',
                'parameter': 'CSDGROUP(DUMMY)'
            }
        })