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

Make magical auto assignment happen #102

Open
rtucker-mozilla opened this issue Jul 23, 2012 · 1 comment
Open

Make magical auto assignment happen #102

rtucker-mozilla opened this issue Jul 23, 2012 · 1 comment

Comments

@rtucker-mozilla
Copy link
Owner

Make a function to be able to figure out the vlan/ip address information from hostname and assign an available ip address

@ghost ghost assigned uberj Jul 23, 2012
@uberj
Copy link
Contributor

uberj commented Jul 23, 2012

Notes for later
Given a hostname like 'foo.dmz.corp.phx1.mozilla.com' parse the name into the following objects.

...mozilla.com

In this case:

label = 'foo'
vlan = 'dmz'
site = 'phx1.corp'

With this info, do:

    phx1 = Site.objects.get(name='phx1')
    corp_phx1 = Site.objects.get(name='corp', parent=phx1)
    vlan = Vlan.objects.get(name='dmz')
    networks = vlan.network_set.filter(site=corp_phx1)
    for network in networks:
        for range in network.range_set.all():
            # If the range has a free ip, use it!

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

No branches or pull requests

2 participants