Buggy code:
public class SdnVeAgentSshDriver extends AbstractSoftwareProcessSshDriver implements SdnVeAgentDriver { private static final Logger LOG = LoggerFactory . getLogger ( SdnVeAgent . class ) ; public SdnVeAgentSshDriver ( EntityLocal entity , SshMachineLocation machine ) { } @ Override public Set < Integer > getPortsUsed ( ) { } protected Map < String , Integer > getPortMap ( ) { } @ Override public void preInstall ( ) { } @ Override public void install ( ) { } @ Override public void customize ( ) { } private int createNetwork ( ) { } private void createSubnet ( String subnetId , String subnetName , InetAddress gatewayIp , Cidr subnetCidr ) { } private String copyJsonTemplate ( String fileName , Map < String , String > substitutions ) { } private String callRestApi ( String jsonData , String apiPath ) { } private int getNetworkIdForName ( String networkName ) { } private void attachPublicAddress ( String containerId , InetAddress privateAddress , InetAddress publicAddress ) { } @ Override public void launch ( ) { } @ Override public boolean isRunning ( ) { } @ Override public void stop ( ) { } @ Override public void createSubnet ( String subnetId , String subnetName , Cidr subnetCidr ) { } @ Override public InetAddress attachNetwork ( String containerId , String subnetId ) { Tasks . setBlockingDetails ( String . format ( "Attach<seq2seq4repair_space>%s<seq2seq4repair_space>to<seq2seq4repair_space>%s" , containerId , subnetId ) ) ; try { InetAddress address = getEntity ( ) . getAttribute ( SDN_PROVIDER ) . getNextContainerAddress ( subnetId ) ; String networkScript = Urls . mergePaths ( getRunDir ( ) , "network.sh" ) ; Integer bridgeId = getEntity ( ) . getAttribute ( DOVE_BRIDGE_ID ) ; <START_BUG> Cidr cidr = getEntity ( ) . getAttribute ( SdnVeAgent . SDN_PROVIDER ) . getSubnetCidr ( subnetId ) ; <END_BUG> String command = String . format ( "%s<seq2seq4repair_space>%s<seq2seq4repair_space>%s<seq2seq4repair_space>%s<seq2seq4repair_space>fa:16:%02x:%02x:%02x:%02x<seq2seq4repair_space>%s//%d<seq2seq4repair_space>%s<seq2seq4repair_space>%d<seq2seq4repair_space>%s" , networkScript , containerId , getEntity ( ) . getApplicationId ( ) , Identifiers . makeRandomId ( 8 ) , address . getAddress ( ) [ 0 ] , address . getAddress ( ) [ 1 ] , address . getAddress ( ) [ 2 ] , address . getAddress ( ) [ 3 ] , address . getHostAddress ( ) , cidr . getLength ( ) , cidr . addressAtOffset ( 1 ) . getHostAddress ( ) , bridgeId , subnetId ) ; getEntity ( ) . getConfig ( DOCKER_HOST ) . execCommand ( sudo ( command ) ) ; Optional < Entity > found = Iterables . tryFind ( getEntity ( ) . getAttribute ( SDN_PROVIDER ) . getAttribute ( SDN_NETWORKS ) . getMembers ( ) , EntityPredicates . attributeEqualTo ( NETWORK_ID , subnetId ) ) ; if ( ! ( found . isPresent ( ) ) ) { throw new IllegalStateException ( String . format ( "Cannot<seq2seq4repair_space>find<seq2seq4repair_space>virtual<seq2seq4repair_space>network<seq2seq4repair_space>entity<seq2seq4repair_space>for<seq2seq4repair_space>%s" , subnetId ) ) ; } VirtualNetwork network = ( ( VirtualNetwork ) ( found . get ( ) ) ) ; if ( Boolean . TRUE . equals ( network . getConfig ( ENABLE_PUBLIC_ACCESS ) ) ) { Cidr publicCidr = network . getConfig ( PUBLIC_CIDR ) ; getEntity ( ) . getAttribute ( SdnVeAgent . SDN_PROVIDER ) . recordSubnetCidr ( ( subnetId + ".public" ) , publicCidr , ( - 1 ) ) ; InetAddress publicAddress = getEntity ( ) . getAttribute ( SDN_PROVIDER ) . getNextContainerAddress ( ( subnetId + ".public" ) ) ; attachPublicAddress ( containerId , address , publicAddress ) ; Collection < Entity > containers = getEntity ( ) . getAttribute ( SDN_PROVIDER ) . getAttribute ( DOCKER_INFRASTRUCTURE ) . getAttribute ( DOCKER_CONTAINER_FABRIC ) . getMembers ( ) ; Optional < DockerContainer > container = Iterables . tryFind ( Iterables . filter ( containers , DockerContainer . class ) , EntityPredicates . attributeEqualTo ( CONTAINER_ID , containerId ) ) ; if ( ! ( container . isPresent ( ) ) ) { throw new IllegalStateException ( String . format ( "Cannot<seq2seq4repair_space>find<seq2seq4repair_space>container<seq2seq4repair_space>entity<seq2seq4repair_space>for<seq2seq4repair_space>%s" , containerId ) ) ; } Entities . deproxy ( container . get ( ) ) . setAttribute ( PUBLIC_CIDR , publicCidr ) ; Entities . deproxy ( container . get ( ) ) . setAttribute ( PUBLIC_ADDRESS , publicAddress ) ; } return address ; } finally { Tasks . resetBlockingDetails ( ) ; } } }

Fix:
Cidr cidr = getEntity ( ) . getAttribute ( SDN_PROVIDER ) . getSubnetCidr ( subnetId ) ;