Skip to content

Conversation

@vojtechcima
Copy link

Added support for port range specification in network firewall. Port ranges can be specified as a string value with : delimiter between start and end port (e.g. '15000:15100').

Following example allows INGRESS for ports TCP 22 and TCP 15000-15100 (both inclusive).

node_templates:
  network:
    type: cloudify.cloudstack.nodes.Network
    properties:
      firewall:
        - type: ingress
          protocol: TCP
          cidr: 0.0.0.0/0
          ports: [22, '15000:15100']

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add

else:
    raise NonRecoverableError(
        'port may be a single port or a port range '
        'in the format start_port:end_port')

In the scenario that a user puts a typo like "80:443:8080", instead of "80, 443, 8080" or even "80:443, 8080", this will raise an error instead of doing something unexpected.

@EarthmanT
Copy link

In 3.3, you can also add a data_type for a firewall that could define this better. However, for 3.2, your approach is probably the best way to make this possible.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants