示例#1
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'
    })
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
    ))
示例#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(*)'
            }
        })
示例#4
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'}]
        }
    })
示例#5
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'
                }]
            }
        })
示例#6
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
    ))
示例#7
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
    ))
示例#8
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'}
        ]
    })
示例#9
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'
            }
        }
    })
示例#10
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'
                }
            }
        })
示例#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=%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)'
            }
        })