Class: Synthra::Types::TechnologyInternet::IpV4Cidr

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/technology_internet/networking.rb

Overview

IpV4Cidr type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



115
116
117
# File 'lib/synthra/types/technology_internet/networking.rb', line 115

def generate_edge(rng, context, args)
  ["0.0.0.0/0", "255.255.255.255/32"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



119
120
121
# File 'lib/synthra/types/technology_internet/networking.rb', line 119

def generate_invalid(rng, context, args)
  [nil, "not cidr", "invalid", [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



108
109
110
111
112
113
# File 'lib/synthra/types/technology_internet/networking.rb', line 108

def generate_random(rng, context, args)
  # Generate IP with CIDR notation (e.g., 192.168.1.0/24)
  ip = TechnologyInternet::Ip.new.generate_random(rng, context, {})
  cidr = rng.int(8, 30) # Common CIDR ranges
  "#{ip}/#{cidr}"
end