Skip to content

Instantly share code, notes, and snippets.

@jflemer-ndp
Created December 30, 2015 21:57
Show Gist options
  • Save jflemer-ndp/8806b38759c6169d71d5 to your computer and use it in GitHub Desktop.
Save jflemer-ndp/8806b38759c6169d71d5 to your computer and use it in GitHub Desktop.
junos legacy dhcp to extended dhcp conversion for static reservations
#!/usr/bin/env perl
$i = "FOO";
$p = "BAR";
while(<>){
if(m/system services dhcp static-binding (\S*) (\S*) (\S*)/){$d{$1}->{$2}=$3}
}
map {
printf("set routing-instances $i access address-assignment pool $p family inet host %s hardware-address %s\n", $d{$_}->{"host-name"}, $_);
printf("set routing-instances $i access address-assignment pool $p family inet host %s ip-address %s\n", $d{$_}->{"host-name"}, $d{$_}->{"fixed-address"});
} keys %d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment