@@ -1688,6 +1688,55 @@ def test_create_ports_bulk_ip_allocation_without_mac_no_net(self):
1688
1688
ctx , ports
1689
1689
)
1690
1690
1691
+ def test_create_ports_bulk_with_allowed_address_pairs (self ):
1692
+ ctx = context .get_admin_context ()
1693
+ with self .network () as net :
1694
+
1695
+ aap = [{
1696
+ 'ip_address' : '1.2.3.4' ,
1697
+ 'mac_address' : '01:23:45:67:89:ab' ,
1698
+ }]
1699
+ ports_in = {
1700
+ 'ports' : [{'port' : {
1701
+ 'allowed_address_pairs' : aap ,
1702
+ 'network_id' : net ['network' ]['id' ],
1703
+ 'project_id' : self ._tenant_id ,
1704
+
1705
+ 'admin_state_up' : True ,
1706
+ 'device_id' : '' ,
1707
+ 'device_owner' : '' ,
1708
+ 'fixed_ips' : constants .ATTR_NOT_SPECIFIED ,
1709
+ 'name' : '' ,
1710
+ 'security_groups' : constants .ATTR_NOT_SPECIFIED ,
1711
+ }}]}
1712
+ ports_out = self .plugin .create_port_bulk (ctx , ports_in )
1713
+ self .assertEqual (aap , ports_out [0 ]['allowed_address_pairs' ])
1714
+
1715
+ def test_create_ports_bulk_with_extra_dhcp_opts (self ):
1716
+ ctx = context .get_admin_context ()
1717
+ with self .network () as net :
1718
+
1719
+ edo = [{
1720
+ 'opt_name' : 'domain-name-servers' ,
1721
+ 'opt_value' : '10.0.0.1' ,
1722
+ 'ip_version' : 4 ,
1723
+ }]
1724
+ ports_in = {
1725
+ 'ports' : [{'port' : {
1726
+ 'extra_dhcp_opts' : edo ,
1727
+ 'network_id' : net ['network' ]['id' ],
1728
+ 'project_id' : self ._tenant_id ,
1729
+
1730
+ 'admin_state_up' : True ,
1731
+ 'device_id' : '' ,
1732
+ 'device_owner' : '' ,
1733
+ 'fixed_ips' : constants .ATTR_NOT_SPECIFIED ,
1734
+ 'name' : '' ,
1735
+ 'security_groups' : constants .ATTR_NOT_SPECIFIED ,
1736
+ }}]}
1737
+ ports_out = self .plugin .create_port_bulk (ctx , ports_in )
1738
+ self .assertEqual (edo , ports_out [0 ]['extra_dhcp_opts' ])
1739
+
1691
1740
def test_delete_port_no_notify_in_disassociate_floatingips (self ):
1692
1741
ctx = context .get_admin_context ()
1693
1742
plugin = directory .get_plugin ()
0 commit comments