Revision e4def9d6

b/Changelog
191 191
  needed by the newer version of snf-vncauthproxy. Support for older versions
192 192
  of snf-vncauthproxy has been dropped. See also the upgrade notes for Synnefo
193 193
  and snf-vncauthproxy-1.5.
194
* Remove 'DEFAULT_ROUTING_TABLE' setting. If a link for an IP_LESS_ROUTED
195
  network is not specified, the link will be uniquely named
196
  'snf-link-$network_id'.
194 197

  
195 198

  
196 199
Cyclades UI
b/docs/networks.rst
121 121
==============   =======   ===============================   ======================  ==================
122 122
Flavor Name      Mode      Link                              MAC prefix              Tags
123 123
==============   =======   ===============================   ======================  ==================
124
IP_LESS_ROUTED   routed    ``DEFAULT_ROUTING_TABLE``         ``DEFAULT_MAC_PREFIX``  'ip-less-routed'
124
IP_LESS_ROUTED   routed    ``snf-link-$network_id``          ``DEFAULT_MAC_PREFIX``  'ip-less-routed'
125 125
MAC_FILTERED     bridged   ``DEFAULT_MAC_FILTERED_BRIDGE``   'pool'                  'private'filtered'
126 126
PHYSICAL_VLAN    bridged   'pool'                            ``DEFAULT_MAC_PREFIX``  'physical-vlan'
127 127
CUSTOM           bridged   ``DEFAULT_BRIDGE``                ``DEFAULT_MAC_PREFIX``
128 128
==============   =======   ===============================   ======================  ==================
129 129

  
130
``DEFAULT_ROUTING_TABLE``, ``DEFAULT_MAC_PREFIX``, ``DEFAULT_BRIDGE``,
130
``DEFAULT_MAC_PREFIX``, ``DEFAULT_BRIDGE``,
131 131
``DEFAULT_MAC_FILTERED_BRIDGE`` are all configurable settings in
132 132
``/etc/synnefo/20-snf-cyclades-app-api.conf``. 'pool' is used to denote that a
133 133
link or MAC prefix will be allocated from the corresponding Pool. Finally,
b/snf-cyclades-app/conf/20-snf-cyclades-app-api.conf
54 54
#DEFAULT_BRIDGE = 'br0'
55 55
#
56 56
## Network flavors that users are allowed to create through API requests
57
## Available flavors are IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
57 58
#API_ENABLED_NETWORK_FLAVORS = ['MAC_FILTERED']
58 59
#
59
## Settings for IP_LESS_ROUTED network:
60
## -----------------------------------
61
## In this case VMCs act as routers that forward the traffic to/from VMs, based
62
## on the defined routing table($DEFAULT_ROUTING_TABLE) and ip rules, that
63
## exist in every node, implenting an IP-less routed and proxy-arp setup.
64
#DEFAULT_ROUTING_TABLE = 'snf_public'
65 60
#
66 61
## Settings for MAC_FILTERED network:
67 62
## ------------------------------------------
b/snf-cyclades-app/synnefo/app_settings/default/api.py
53 53
DEFAULT_BRIDGE = 'br0'
54 54

  
55 55
# Network flavors that users are allowed to create through API requests
56
# Available flavors are IP_LESS_ROUTED, MAC_FILTERED, PHYSICAL_VLAN
56 57
API_ENABLED_NETWORK_FLAVORS = ['MAC_FILTERED']
57 58

  
58
# Settings for IP_LESS_ROUTED network:
59
# -----------------------------------
60
# In this case VMCs act as routers that forward the traffic to/from VMs, based
61
# on the defined routing table($DEFAULT_ROUTING_TABLE) and ip rules, that
62
# exist in every node, implenting an IP-less routed and proxy-arp setup.
63
DEFAULT_ROUTING_TABLE = 'snf_public'
64

  
65 59
# Settings for MAC_FILTERED network:
66 60
# ------------------------------------------
67 61
# All networks of this type are bridged to the same bridge. Isolation between
b/snf-cyclades-app/synnefo/db/models.py
448 448
        },
449 449
        'IP_LESS_ROUTED': {
450 450
            'mode': 'routed',
451
            'link': settings.DEFAULT_ROUTING_TABLE,
451
            'link': None,
452 452
            'mac_prefix': settings.DEFAULT_MAC_PREFIX,
453 453
            'tags': 'ip-less-routed',
454 454
            'desc': "Flavor used for an IP-less routed network using"
b/snf-cyclades-app/synnefo/logic/networks.py
33 33

  
34 34
from functools import wraps
35 35
from django.db import transaction
36
from django.conf import settings
36 37

  
37 38
from snf_django.lib.api import faults
38 39
from synnefo.api import util
......
88 89
    mac_prefix = mac_prefix or fmac_prefix
89 90
    tags = tags or ftags
90 91

  
91
    if (flavor == "IP_LESS_ROUTED" and
92
       Network.objects.filter(deleted=False, mode=mode, link=link).exists()):
93
        msg = "Link '%s' is already used." % link
94
        raise faults.BadRequest(msg)
95

  
96 92
    validate_mac(mac_prefix + "0:00:00:00")
97 93

  
98 94
    network = Network.objects.create(
......
110 106
        state='ACTIVE',
111 107
        drained=drained)
112 108

  
109
    if link is None:
110
        network.link = "%slink-%d" % (settings.BACKEND_PREFIX_ID, network.id)
111
        network.save()
112

  
113
    if (flavor == "IP_LESS_ROUTED" and
114
       Network.objects.filter(deleted=False, mode=mode, link=link).exists()):
115
        msg = "Link '%s' is already used." % link
116
        raise faults.BadRequest(msg)
117

  
113 118
    # Issue commission to Quotaholder and accept it since at the end of
114 119
    # this transaction the Network object will be created in the DB.
115 120
    # Note: the following call does a commit!
b/snf-cyclades-app/synnefo/logic/tests/networks.py
97 97
            net = networks.create(**kwargs)
98 98
        self.assertEqual(net.mode, "routed")
99 99
        self.assertEqual(net.mac_prefix, settings.DEFAULT_MAC_PREFIX)
100
        self.assertEqual(net.link, settings.DEFAULT_ROUTING_TABLE)
100
        self.assertEqual(net.link, "%slink-%d" % (settings.BACKEND_PREFIX_ID,
101
                                                  net.id))
101 102
        self.assertEqual(net.backend_tag, ["ip-less-routed"])
102 103

  
103 104
        # CUSTOM

Also available in: Unified diff