Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Ipv6Ranges #1523

Closed
geoffreywiseman opened this issue Mar 21, 2018 · 2 comments
Closed

Implement Ipv6Ranges #1523

geoffreywiseman opened this issue Mar 21, 2018 · 2 comments

Comments

@geoffreywiseman
Copy link

Why can't I access 'Ipv6Ranges' on a security group's ip permissions?

@mock_ec2
def test_security_group_ipv6ranges():
    ec2 = boto3.resource('ec2', 'ca-central-1')
    vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
    sg = ec2.create_security_group(Description='Test SG', GroupName='test-sg', VpcId=vpc.id)
    sg.authorize_ingress(IpPermissions=[
        {
            'FromPort': 22,
            'ToPort': 22,
            'IpProtocol': 'tcp',
            'IpRanges': [
                {
                    'CidrIp': '192.168.0.1/32'
                }
            ],
            'Ipv6Ranges': []
        }
    ])
    assert len(sg.ip_permissions) == 1
    assert len(sg.ip_permissions[0]['Ipv6Ranges']) == 0

Last line of this pytest fails:

Testing started at 11:16 ...
============================= test session starts ==============================
platform darwin -- Python 3.6.4, pytest-3.4.2, py-1.5.2, pluggy-0.6.0
collected 1 item
test_moto_ipv6ranges.py F
tests/test_moto_ipv6ranges.py:6 (test_security_group_ipv6ranges)
@mock_ec2
    def test_security_group_ipv6ranges():
        ec2 = boto3.resource('ec2', 'ca-central-1')
        vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
        sg = ec2.create_security_group(Description='Test SG', GroupName='test-sg', VpcId=vpc.id)
        sg.authorize_ingress(IpPermissions=[
            {
                'FromPort': 22,
                'ToPort': 22,
                'IpProtocol': 'tcp',
                'IpRanges': [
                    {
                        'CidrIp': '192.168.0.1/32'
                    }
                ],
                'Ipv6Ranges': []
            }
        ])
        assert len(sg.ip_permissions) == 1
>       assert len(sg.ip_permissions[0]['Ipv6Ranges']) == 0
E       KeyError: 'Ipv6Ranges'

test_moto_ipv6ranges.py:26: KeyError
                                                [100%]

=================================== FAILURES ===================================
________________________ test_security_group_ipv6ranges ________________________

    @mock_ec2
    def test_security_group_ipv6ranges():
        ec2 = boto3.resource('ec2', 'ca-central-1')
        vpc = ec2.create_vpc(CidrBlock='10.0.0.0/16')
        sg = ec2.create_security_group(Description='Test SG', GroupName='test-sg', VpcId=vpc.id)
        sg.authorize_ingress(IpPermissions=[
            {
                'FromPort': 22,
                'ToPort': 22,
                'IpProtocol': 'tcp',
                'IpRanges': [
                    {
                        'CidrIp': '192.168.0.1/32'
                    }
                ],
                'Ipv6Ranges': []
            }
        ])
        assert len(sg.ip_permissions) == 1
>       assert len(sg.ip_permissions[0]['Ipv6Ranges']) == 0
E       KeyError: 'Ipv6Ranges'

test_moto_ipv6ranges.py:26: KeyError
=========================== 1 failed in 1.58 seconds ===========================

Expected the test to pass.
Moto 1.2.0, boto 1.6.6, pipenv.

@spulec
Copy link
Collaborator

spulec commented Apr 13, 2018

Yeah, this hasn't been implemented yet. I'm going to set this as a feature request.

@spulec spulec changed the title KeyError: Ipv6Ranges? Implement Ipv6Ranges Apr 13, 2018
@bblommers
Copy link
Collaborator

The above test passes now against master - I believe this was implemented as of Moto >= 2.2.5.
I'll close this, but let us know if there's still anything missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants