controllers

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 60 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuditTrailFinalizer = "audittrail.nephoran.io/finalizer"

	ConditionTypeReady = "Ready"

	ConditionTypeProgressing = "Progressing"

	ConditionTypeBackendsReady = "BackendsReady"

	ConditionTypeIntegrityReady = "IntegrityReady"

	EventReasonCreated = "Created"

	EventReasonUpdated = "Updated"

	EventReasonStarted = "Started"

	EventReasonStopped = "Stopped"

	EventReasonBackendFailed = "BackendFailed"

	EventReasonIntegrityFailed = "IntegrityFailed"

	EventReasonConfigChanged = "ConfigChanged"
)
View Source
const (
	CNFDeploymentControllerName = "cnfdeployment-controller"

	CNFReconcileInterval = 30 * time.Second

	CNFStatusUpdateInterval = 10 * time.Second
)
View Source
const (
	E2NodeSetFinalizer = "nephoran.com/e2nodeset-finalizer"

	E2NodeSetLabelKey = "nephoran.com/e2-nodeset"

	E2NodeAppLabelKey = "app"

	E2NodeAppLabelValue = "e2-node-simulator"

	E2NodeIDLabelKey = "nephoran.com/node-id"

	E2NodeIndexLabelKey = "nephoran.com/node-index"

	E2NodeConfigKey = "e2node-config.json"

	E2NodeStatusKey = "e2node-status.json"

	DefaultHeartbeatInterval = 10 * time.Second

	DefaultMetricsInterval = "30s"

	DefaultE2InterfaceVersion = "v3.0"

	DefaultMaxRetries = 3

	BaseBackoffDelay = 1 * time.Second

	MaxBackoffDelay = 5 * time.Minute

	JitterFactor = 0.1 // 10% jitter

	BackoffMultiplier = 2.0
)
View Source
const (
	StatusFailed float64 = 0

	StatusProcessing float64 = 1

	StatusReady float64 = 2
)
View Source
const (
	CNFIntentLabel = "nephoran.com/cnf-intent"

	CNFDeploymentSourceLabel = "nephoran.com/source"

	CNFDeploymentSourceValue = "network-intent"

	CNFDeploymentIntentLabel = "nephoran.com/network-intent"

	CNFProcessingResultAnnotation = "nephoran.com/cnf-processing-result"

	CNFLastProcessedAnnotation = "nephoran.com/cnf-last-processed"

	EventCNFIntentDetected = "CNFIntentDetected"

	EventCNFProcessingStarted = "CNFProcessingStarted"

	EventCNFProcessingCompleted = "CNFProcessingCompleted"

	EventCNFProcessingFailed = "CNFProcessingFailed"

	EventCNFDeploymentCreated = "CNFDeploymentCreated"

	EventCNFDeploymentFailed = "CNFDeploymentFailed"
)
View Source
const (
	O1ConfiguredCondition = "O1Configured"

	A1PolicyAppliedCondition = "A1PolicyApplied"
)

Variables

View Source
var (
	ErrGitAuthenticationFailed = errors.New("SSH key authentication failed")
	ErrGitNetworkTimeout       = errors.New("network timeout during Git operation")
	ErrGitRepositoryCorrupted  = errors.New("repository is corrupted or locked")
	ErrGitDirectoryNotFound    = errors.New("directory not found in repository")
	ErrGitPushRejected         = errors.New("push rejected by remote repository")
	ErrGitNoChangesToCommit    = errors.New("no changes to commit")
)

Git operation error constants used by cleanup tests

Functions

func CalculateExponentialBackoff

func CalculateExponentialBackoff(retryCount int, config *BackoffConfig) time.Duration

CalculateExponentialBackoff calculates the exponential backoff delay with jitter retryCount: current retry attempt (0-based) config: backoff configuration parameters

func CalculateExponentialBackoffForE2NodeSetOperation

func CalculateExponentialBackoffForE2NodeSetOperation(retryCount int, operation string) time.Duration

CalculateExponentialBackoffForE2NodeSetOperation calculates backoff for E2NodeSet operations

func CalculateExponentialBackoffForNetworkIntentOperation

func CalculateExponentialBackoffForNetworkIntentOperation(retryCount int, operation string, constants *configPkg.Constants) time.Duration

CalculateExponentialBackoffForNetworkIntentOperation calculates backoff for NetworkIntent operations

func CalculateExponentialBackoffWithConstants

func CalculateExponentialBackoffWithConstants(retryCount int, baseDelay, maxDelay time.Duration, constants *configPkg.Constants) time.Duration

CalculateExponentialBackoffWithConstants calculates backoff using configPkg.Constants for backward compatibility with NetworkIntent controller

func ClearE2NodeSetRetryCount

func ClearE2NodeSetRetryCount(e2nodeSet *nephoranv1.E2NodeSet, operation string)

ClearE2NodeSetRetryCount removes the retry count for an E2NodeSet operation from annotations

func ClearNetworkIntentRetryCount

func ClearNetworkIntentRetryCount(networkIntent *nephoranv1.NetworkIntent, operation string)

ClearNetworkIntentRetryCount removes the retry count for a NetworkIntent operation from annotations

func GetE2NodeSetRetryCount

func GetE2NodeSetRetryCount(e2nodeSet *nephoranv1.E2NodeSet, operation string) int

GetE2NodeSetRetryCount retrieves the retry count for an E2NodeSet operation from annotations

func GetMetricsEnabled

func GetMetricsEnabled() bool

func GetNetworkIntentRetryCount

func GetNetworkIntentRetryCount(networkIntent *nephoranv1.NetworkIntent, operation string) int

GetNetworkIntentRetryCount retrieves the retry count for a NetworkIntent operation from annotations

func SetE2NodeSetRetryCount

func SetE2NodeSetRetryCount(e2nodeSet *nephoranv1.E2NodeSet, operation string, count int)

SetE2NodeSetRetryCount sets the retry count for an E2NodeSet operation in annotations

func SetNetworkIntentRetryCount

func SetNetworkIntentRetryCount(networkIntent *nephoranv1.NetworkIntent, operation string, count int)

SetNetworkIntentRetryCount sets the retry count for a NetworkIntent operation in annotations

func UpdateCondition

func UpdateCondition(conditions *[]metav1.Condition, newCondition metav1.Condition)

UpdateCondition updates or adds a condition to a condition slice

Types

type A1Policy

type A1Policy struct {
	PolicyTypeID string `json:"policy_type_id"`

	PolicyData json.RawMessage `json:"policy_data"`
}

type AuditTrailController

type AuditTrailController struct {
	client.Client

	Log logr.Logger

	Scheme *runtime.Scheme

	Recorder record.EventRecorder
	// contains filtered or unexported fields
}

func NewAuditTrailController

func NewAuditTrailController(client client.Client, log logr.Logger, scheme *runtime.Scheme, recorder record.EventRecorder) *AuditTrailController

func (*AuditTrailController) GetAuditSystem

func (r *AuditTrailController) GetAuditSystem(namespace, name string) *audit.AuditSystem

func (*AuditTrailController) Reconcile

func (r *AuditTrailController) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*AuditTrailController) SetupWithManager

func (r *AuditTrailController) SetupWithManager(mgr ctrl.Manager) error

type AuthContextKey

type AuthContextKey string
const (
	ControllerAuthContextKey AuthContextKey = "controller_auth_context"
)

type AuthenticatedE2NodeSetReconciler

type AuthenticatedE2NodeSetReconciler struct {
	*AuthenticatedReconciler

	OriginalReconciler *E2NodeSetReconciler
}

func NewAuthenticatedE2NodeSetReconciler

func NewAuthenticatedE2NodeSetReconciler(
	originalReconciler *E2NodeSetReconciler,

	authIntegration *auth.NephoranAuthIntegration,

	logger *slog.Logger,

	requireAuth bool,
) *AuthenticatedE2NodeSetReconciler

func (*AuthenticatedE2NodeSetReconciler) Reconcile

func (*AuthenticatedE2NodeSetReconciler) SetupWithManager

func (aer *AuthenticatedE2NodeSetReconciler) SetupWithManager(mgr ctrl.Manager) error

type AuthenticatedReconciler

type AuthenticatedReconciler struct {
	client.Client
	// contains filtered or unexported fields
}

func NewAuthenticatedReconciler

func NewAuthenticatedReconciler(
	client client.Client,

	authIntegration *auth.NephoranAuthIntegration,

	logger *slog.Logger,

	requireAuth bool,
) *AuthenticatedReconciler

func (*AuthenticatedReconciler) ValidateNetworkIntentAccess

func (ar *AuthenticatedReconciler) ValidateNetworkIntentAccess(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, operation string) error

func (*AuthenticatedReconciler) WithAuthContext

func (ar *AuthenticatedReconciler) WithAuthContext(ctx context.Context, operation, resourceType, resourceName, resourceNamespace string) (context.Context, error)

type BackoffConfig

type BackoffConfig struct {
	BaseDelay    time.Duration
	MaxDelay     time.Duration
	Multiplier   float64
	JitterFactor float64
}

BackoffConfig holds configuration for exponential backoff

func DefaultBackoffConfig

func DefaultBackoffConfig() *BackoffConfig

DefaultBackoffConfig returns the default backoff configuration

type CNFControllerConfig

type CNFControllerConfig struct {
	ReconcileTimeout time.Duration

	MaxConcurrentReconciles int

	EnableStatusUpdates bool

	StatusUpdateInterval time.Duration

	EnableMetrics bool

	EnableEvents bool
}

type CNFDeploymentContext

type CNFDeploymentContext struct {
	NetworkIntent *nephoranv1.NetworkIntent

	ProcessingResult *nephoranv1.CNFIntentProcessingResult

	CNFDeployments []*nephoranv1.CNFDeployment

	StartTime time.Time

	RequestID string

	ProcessingPhase string

	Errors []error

	Warnings []string
}

type CNFDeploymentReconciler

type CNFDeploymentReconciler struct {
	client.Client

	Scheme *runtime.Scheme

	Recorder record.EventRecorder

	CNFOrchestrator *cnf.CNFOrchestrator

	LLMProcessor *llm.Processor

	MetricsCollector *monitoring.MetricsCollector

	Config *CNFControllerConfig
}

func NewCNFDeploymentReconciler

func NewCNFDeploymentReconciler(mgr ctrl.Manager, cnfOrchestrator *cnf.CNFOrchestrator) *CNFDeploymentReconciler

func (*CNFDeploymentReconciler) Reconcile

func (r *CNFDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*CNFDeploymentReconciler) SetupWithManager

func (r *CNFDeploymentReconciler) SetupWithManager(mgr ctrl.Manager) error

type CNFDeploymentRequest

type CNFDeploymentRequest struct {
	CNFDeployment *nephoranv1.CNFDeployment

	Context context.Context

	RequestID string

	Source string // "intent" or "direct"

	NetworkIntent *nephoranv1.NetworkIntent
}

type CNFIntegrationConfig

type CNFIntegrationConfig struct {
	EnableCNFIntegration bool

	CNFProcessingTimeout time.Duration

	CNFDeploymentTimeout time.Duration

	MaxConcurrentCNFDeploys int

	EnableAutoDeployment bool

	RequireExplicitApproval bool

	DefaultTargetNamespace string

	CNFLabelSelector map[string]string

	RetryPolicy CNFRetryPolicy
}

type CNFIntegrationManager

type CNFIntegrationManager struct {
	Client client.Client

	Scheme *runtime.Scheme

	Recorder record.EventRecorder

	CNFIntentProcessor *cnf.CNFIntentProcessor

	CNFOrchestrator *cnf.CNFOrchestrator

	Config *CNFIntegrationConfig
}

func NewCNFIntegrationManager

func NewCNFIntegrationManager(
	client client.Client,

	scheme *runtime.Scheme,

	recorder record.EventRecorder,

	cnfProcessor *cnf.CNFIntentProcessor,

	cnfOrchestrator *cnf.CNFOrchestrator,
) *CNFIntegrationManager

func (*CNFIntegrationManager) ProcessCNFIntent

func (m *CNFIntegrationManager) ProcessCNFIntent(ctx context.Context, networkIntent *nephoranv1.NetworkIntent) error

type CNFRetryPolicy

type CNFRetryPolicy struct {
	MaxRetries int

	InitialDelay time.Duration

	MaxDelay time.Duration

	BackoffMultiplier float64
}

type CertificateAutomationCondition

type CertificateAutomationCondition struct {
	Type CertificateAutomationConditionType `json:"type"`

	Status metav1.ConditionStatus `json:"status"`

	LastTransitionTime metav1.Time `json:"lastTransitionTime"`

	Reason string `json:"reason,omitempty"`

	Message string `json:"message,omitempty"`
}

type CertificateAutomationConditionType

type CertificateAutomationConditionType string
const (
	CertificateAutomationConditionReady CertificateAutomationConditionType = "Ready"

	CertificateAutomationConditionIssued CertificateAutomationConditionType = "Issued"

	CertificateAutomationConditionValidated CertificateAutomationConditionType = "Validated"

	CertificateAutomationConditionRenewed CertificateAutomationConditionType = "Renewed"

	CertificateAutomationConditionRevoked CertificateAutomationConditionType = "Revoked"
)

type CertificateAutomationReconciler

type CertificateAutomationReconciler struct {
	client.Client

	Scheme *runtime.Scheme

	Log logr.Logger

	AutomationEngine *ca.AutomationEngine

	CAManager *ca.CAManager
}

func (*CertificateAutomationReconciler) Reconcile

func (*CertificateAutomationReconciler) SetupWithManager

func (r *CertificateAutomationReconciler) SetupWithManager(mgr ctrl.Manager) error

type CertificateAutomationSpec

type CertificateAutomationSpec struct {
	ServiceName string `json:"serviceName"`

	Namespace string `json:"namespace"`

	DNSNames []string `json:"dnsNames,omitempty"`

	IPAddresses []string `json:"ipAddresses,omitempty"`

	Template string `json:"template,omitempty"`

	AutoRenewal bool `json:"autoRenewal,omitempty"`

	ValidityDuration *metav1.Duration `json:"validityDuration,omitempty"`

	SecretName string `json:"secretName,omitempty"`

	Priority string `json:"priority,omitempty"`
}

type CertificateAutomationStatus

type CertificateAutomationStatus struct {
	Phase nephv1alpha1.CertificateAutomationPhase `json:"phase,omitempty"`

	Conditions []CertificateAutomationCondition `json:"conditions,omitempty"`

	CertificateSerialNumber string `json:"certificateSerialNumber,omitempty"`

	ExpiresAt *metav1.Time `json:"expiresAt,omitempty"`

	LastRenewalTime *metav1.Time `json:"lastRenewalTime,omitempty"`

	NextRenewalTime *metav1.Time `json:"nextRenewalTime,omitempty"`

	SecretRef *v1.LocalObjectReference `json:"secretRef,omitempty"`

	ValidationStatus *CertificateValidationStatus `json:"validationStatus,omitempty"`

	RevocationStatus string `json:"revocationStatus,omitempty"`

	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
}

type CertificateValidationStatus

type CertificateValidationStatus struct {
	Valid bool `json:"valid"`

	ChainValid bool `json:"chainValid,omitempty"`

	CTLogVerified bool `json:"ctLogVerified,omitempty"`

	LastValidationTime *metav1.Time `json:"lastValidationTime,omitempty"`

	ValidationErrors []string `json:"validationErrors,omitempty"`

	ValidationWarnings []string `json:"validationWarnings,omitempty"`
}

type CleanupManagerInterface

type CleanupManagerInterface interface {
	PerformCleanup(ctx context.Context, networkIntent *nephoranv1.NetworkIntent) error

	CleanupGeneratedResources(ctx context.Context, networkIntent *nephoranv1.NetworkIntent) error

	CleanupCachedData(ctx context.Context, networkIntent *nephoranv1.NetworkIntent) error
}

type ConcreteDependencies

type ConcreteDependencies struct {
	// contains filtered or unexported fields
}

func NewConcreteDependencies

func NewConcreteDependencies(
	gitClient git.ClientInterface,

	llmClient shared.ClientInterface,

	packageGen *nephio.PackageGenerator,

	httpClient *http.Client,

	eventRecorder record.EventRecorder,
) *ConcreteDependencies

func (*ConcreteDependencies) GetEventRecorder

func (d *ConcreteDependencies) GetEventRecorder() record.EventRecorder

func (*ConcreteDependencies) GetGitClient

func (d *ConcreteDependencies) GetGitClient() git.ClientInterface

func (*ConcreteDependencies) GetHTTPClient

func (d *ConcreteDependencies) GetHTTPClient() *http.Client

func (*ConcreteDependencies) GetLLMClient

func (d *ConcreteDependencies) GetLLMClient() shared.ClientInterface

func (*ConcreteDependencies) GetPackageGenerator

func (d *ConcreteDependencies) GetPackageGenerator() *nephio.PackageGenerator

type Config

type Config struct {
	MaxRetries int

	RetryDelay time.Duration

	Timeout time.Duration

	GitRepoURL string

	GitBranch string

	GitDeployPath string

	LLMProcessorURL string

	UseNephioPorch bool

	Constants *configPkg.Constants
}

type ContextManagerInterface

type ContextManagerInterface interface {
	InitializeProcessingContext(networkIntent *nephoranv1.NetworkIntent) *ProcessingContext

	UpdateProcessingContext(processingCtx *ProcessingContext, phase ProcessingPhase, data map[string]interface{})

	ValidateProcessingContext(processingCtx *ProcessingContext, expectedPhase ProcessingPhase) error

	SerializeProcessingContext(processingCtx *ProcessingContext) (string, error)

	DeserializeProcessingContext(data string) (*ProcessingContext, error)
}

type ControllerAuthContext

type ControllerAuthContext struct {
	UserID string

	OperationType string

	ResourceType string

	ResourceName string

	ResourceNamespace string

	Timestamp time.Time

	RequestID string
}

type ControllerInterface

type ControllerInterface interface {
	ReconcilerInterface

	SetupWithManager(mgr ctrl.Manager) error

	GetConfig() *Config

	GetDependencies() Dependencies
}

type ControllerMetrics

type ControllerMetrics struct {
	// contains filtered or unexported fields
}

func NewControllerMetrics

func NewControllerMetrics(controllerName string) *ControllerMetrics

func (*ControllerMetrics) RecordFailure

func (m *ControllerMetrics) RecordFailure(namespace, name, errorType string)

func (*ControllerMetrics) RecordProcessingDuration

func (m *ControllerMetrics) RecordProcessingDuration(namespace, name, phase string, duration float64)

func (*ControllerMetrics) RecordReconcileError

func (m *ControllerMetrics) RecordReconcileError(namespace, name, errorType string)

func (*ControllerMetrics) RecordReconcileTotal

func (m *ControllerMetrics) RecordReconcileTotal(namespace, name, result string)

func (*ControllerMetrics) RecordSuccess

func (m *ControllerMetrics) RecordSuccess(namespace, name string)

func (*ControllerMetrics) SetStatus

func (m *ControllerMetrics) SetStatus(namespace, name, phase string, status float64)

type Dependencies

type Dependencies interface {
	GetGitClient() git.ClientInterface

	GetLLMClient() shared.ClientInterface

	GetPackageGenerator() *nephio.PackageGenerator

	GetHTTPClient() *http.Client

	GetEventRecorder() record.EventRecorder

	GetTelecomKnowledgeBase() *telecom.TelecomKnowledgeBase

	GetMetricsCollector() monitoring.MetricsCollector
}

type DependencyError

type DependencyError struct {
	Dependency string

	Cause error
}

func NewDependencyError

func NewDependencyError(dependency string, cause error) *DependencyError

func (*DependencyError) Error

func (e *DependencyError) Error() string

func (*DependencyError) Unwrap

func (e *DependencyError) Unwrap() error

type DeploymentSpec

type DeploymentSpec struct {
	Replicas int `json:"replicas"`

	Image string `json:"image"`

	Resources json.RawMessage `json:"resources"`
}

type E2NodeConfigData

type E2NodeConfigData struct {
	NodeID string `json:"nodeId"`

	E2InterfaceVersion string `json:"e2InterfaceVersion"`

	RICEndpoint string `json:"ricEndpoint"`

	RANFunctions []RANFunctionConfig `json:"ranFunctions"`

	SimulationConfig SimulationConfigData `json:"simulationConfig"`

	CreatedAt time.Time `json:"createdAt"`

	UpdatedAt time.Time `json:"updatedAt"`
}

type E2NodeSetReconciler

type E2NodeSetReconciler struct {
	client.Client

	Scheme *runtime.Scheme

	Recorder record.EventRecorder

	// External dependencies
	GitClient git.ClientInterface
	E2Manager e2.E2ManagerInterface
	// contains filtered or unexported fields
}

func (*E2NodeSetReconciler) Reconcile

func (r *E2NodeSetReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*E2NodeSetReconciler) RegisterMetrics

func (r *E2NodeSetReconciler) RegisterMetrics()

func (*E2NodeSetReconciler) SetupWithManager

func (r *E2NodeSetReconciler) SetupWithManager(mgr ctrl.Manager) error

type E2NodeStatusData

type E2NodeStatusData struct {
	NodeID string `json:"nodeId"`

	State string `json:"state"`

	LastHeartbeat *time.Time `json:"lastHeartbeat,omitempty"`

	ConnectedSince *time.Time `json:"connectedSince,omitempty"`

	ActiveSubscriptions int32 `json:"activeSubscriptions"`

	ErrorMessage string `json:"errorMessage,omitempty"`

	HeartbeatCount int64 `json:"heartbeatCount"`

	StatusUpdatedAt time.Time `json:"statusUpdatedAt"`
}

type EndpointSpec

type EndpointSpec struct {
	Name string `json:"name"`

	Port int `json:"port"`

	Protocol string `json:"protocol"`

	Path string `json:"path,omitempty"`
}

type EventManagerInterface

type EventManagerInterface interface {
	RecordEvent(networkIntent *nephoranv1.NetworkIntent, eventType, reason, message string)

	RecordFailureEvent(networkIntent *nephoranv1.NetworkIntent, reason, message string)

	RecordSuccessEvent(networkIntent *nephoranv1.NetworkIntent, reason, message string)
}

type GitClientInterface

type GitClientInterface = git.ClientInterface

type GitOpsHandler

type GitOpsHandler struct {
	*NetworkIntentReconciler
}

func NewGitOpsHandler

func NewGitOpsHandler(r *NetworkIntentReconciler) *GitOpsHandler

func (*GitOpsHandler) CleanupGitOpsResources

func (g *GitOpsHandler) CleanupGitOpsResources(ctx context.Context, networkIntent *nephoranv1.NetworkIntent) error

func (*GitOpsHandler) CommitToGitOps

func (g *GitOpsHandler) CommitToGitOps(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*GitOpsHandler) GetPhaseName

func (g *GitOpsHandler) GetPhaseName() ProcessingPhase

func (*GitOpsHandler) IsPhaseComplete

func (g *GitOpsHandler) IsPhaseComplete(networkIntent *nephoranv1.NetworkIntent) bool

func (*GitOpsHandler) ProcessPhase

func (g *GitOpsHandler) ProcessPhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*GitOpsHandler) VerifyDeployment

func (g *GitOpsHandler) VerifyDeployment(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*GitOpsHandler) VerifyDeploymentAdvanced

func (g *GitOpsHandler) VerifyDeploymentAdvanced(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

type GitOpsHandlerInterface

type GitOpsHandlerInterface interface {
	PhaseProcessor

	CommitToGitOps(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	VerifyDeployment(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	CleanupGitOpsResources(ctx context.Context, networkIntent *nephoranv1.NetworkIntent) error
}

type HealthCheckInterface

type HealthCheckInterface interface {
	CheckHealth(ctx context.Context) error

	CheckDependencies(ctx context.Context) error

	CheckLLMHealth(ctx context.Context) error

	CheckGitHealth(ctx context.Context) error
}

type HealthCheckSpec

type HealthCheckSpec struct {
	Type string `json:"type"`

	Path string `json:"path"`

	Port int `json:"port"`

	Interval string `json:"interval"`

	Timeout string `json:"timeout"`

	Retries int `json:"retries"`
}

type InterfaceConfiguration

type InterfaceConfiguration struct {
	Name string `json:"name"`

	Type string `json:"type"`

	Protocol string `json:"protocol"`

	Endpoints []EndpointSpec `json:"endpoints"`

	Security SecuritySpec `json:"security"`

	QoS QoSSpec `json:"qos"`
}

type LLMProcessor

type LLMProcessor struct {
	*NetworkIntentReconciler
}

func NewLLMProcessor

func NewLLMProcessor(r *NetworkIntentReconciler) *LLMProcessor

func (*LLMProcessor) BuildTelecomEnhancedPrompt

func (p *LLMProcessor) BuildTelecomEnhancedPrompt(ctx context.Context, intent string, processingCtx *ProcessingContext) (string, error)

func (*LLMProcessor) ExtractTelecomContext

func (p *LLMProcessor) ExtractTelecomContext(intent string) map[string]interface{}

func (*LLMProcessor) GetPhaseName

func (p *LLMProcessor) GetPhaseName() ProcessingPhase

func (*LLMProcessor) IsPhaseComplete

func (p *LLMProcessor) IsPhaseComplete(networkIntent *nephoranv1.NetworkIntent) bool

func (*LLMProcessor) ProcessLLMPhase

func (p *LLMProcessor) ProcessLLMPhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*LLMProcessor) ProcessPhase

func (p *LLMProcessor) ProcessPhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

type LLMProcessorInterface

type LLMProcessorInterface interface {
	PhaseProcessor

	ProcessLLMPhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	BuildTelecomEnhancedPrompt(ctx context.Context, intent string, processingCtx *ProcessingContext) (string, error)

	ExtractTelecomContext(intent string) map[string]interface{}
}

type MetricsManagerInterface

type MetricsManagerInterface interface {
	RecordProcessingMetrics(phase ProcessingPhase, duration float64, success bool)

	RecordLLMMetrics(model string, tokenCount int, duration float64, success bool)

	RecordGitOpsMetrics(operation string, duration float64, success bool)

	UpdateNetworkIntentStatus(name, namespace, intentType, status string)
}

type MonitoringSpec

type MonitoringSpec struct {
	Enabled bool `json:"enabled"`

	Metrics []string `json:"metrics"`

	Alerts []string `json:"alerts"`

	Dashboards []string `json:"dashboards"`
}

type NetworkFunctionDeploymentIntent

type NetworkFunctionDeploymentIntent struct {
	Type string `json:"type"`

	Name string `json:"name"`

	Namespace string `json:"namespace"`

	Spec DeploymentSpec `json:"spec"`

	O1Config string `json:"o1_config"`

	A1Policy A1Policy `json:"a1_policy"`
}

type NetworkFunctionScaleIntent

type NetworkFunctionScaleIntent struct {
	Type string `json:"type"`

	Name string `json:"name"`

	Namespace string `json:"namespace"`

	Replicas int `json:"replicas"`
}

type NetworkIntentAuthDecorator

type NetworkIntentAuthDecorator struct {
	*AuthenticatedReconciler
	// contains filtered or unexported fields
}

func NewNetworkIntentAuthDecorator

func NewNetworkIntentAuthDecorator(
	originalReconciler *NetworkIntentReconciler,

	authIntegration *auth.NephoranAuthIntegration,

	logger *slog.Logger,

	requireAuth bool,
) *NetworkIntentAuthDecorator

func (*NetworkIntentAuthDecorator) Reconcile

func (niad *NetworkIntentAuthDecorator) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

type NetworkIntentError

type NetworkIntentError struct {
	Phase string

	Operation string

	Cause error

	Retries int

	Timestamp time.Time
}

func NewNetworkIntentError

func NewNetworkIntentError(phase, operation string, cause error, retries int) *NetworkIntentError

func (*NetworkIntentError) Error

func (e *NetworkIntentError) Error() string

func (*NetworkIntentError) IsRetryable

func (e *NetworkIntentError) IsRetryable() bool

func (*NetworkIntentError) Unwrap

func (e *NetworkIntentError) Unwrap() error

type NetworkIntentReconciler

type NetworkIntentReconciler struct {
	client.Client

	Scheme *runtime.Scheme
	// contains filtered or unexported fields
}

func NewNetworkIntentReconciler

func NewNetworkIntentReconciler(client client.Client, scheme *runtime.Scheme, deps Dependencies, config *Config) (*NetworkIntentReconciler, error)

func (*NetworkIntentReconciler) GetConfig

func (r *NetworkIntentReconciler) GetConfig() *Config

GetConfig returns the reconciler configuration for testing

func (*NetworkIntentReconciler) GetDependencies

func (r *NetworkIntentReconciler) GetDependencies() Dependencies

GetDependencies returns the reconciler dependencies for testing

func (*NetworkIntentReconciler) Reconcile

func (r *NetworkIntentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*NetworkIntentReconciler) SetupWithManager

func (r *NetworkIntentReconciler) SetupWithManager(mgr ctrl.Manager) error

type OranAdaptorReconciler

type OranAdaptorReconciler struct {
	client.Client

	Scheme *runtime.Scheme

	O1Adaptor *o1.O1Adaptor

	A1Adaptor *a1.A1Adaptor
}

func (*OranAdaptorReconciler) Reconcile

func (r *OranAdaptorReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

func (*OranAdaptorReconciler) SetupWithManager

func (r *OranAdaptorReconciler) SetupWithManager(mgr ctrl.Manager) error

type PhaseProcessor

type PhaseProcessor interface {
	ProcessPhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	GetPhaseName() ProcessingPhase

	IsPhaseComplete(networkIntent *nephoranv1.NetworkIntent) bool
}

type PlannedNetworkFunction

type PlannedNetworkFunction struct {
	Name string `json:"name"`

	Type string `json:"type"`

	Version string `json:"version"`

	Replicas int `json:"replicas"`

	Resources ResourceRequirements `json:"resources"`

	Configuration json.RawMessage `json:"configuration"`

	Dependencies []string `json:"dependencies"`

	Interfaces []string `json:"interfaces"`

	HealthChecks []HealthCheckSpec `json:"health_checks"`

	Monitoring MonitoringSpec `json:"monitoring"`
}

type ProcessingContext

type ProcessingContext struct {
	StartTime time.Time

	CurrentPhase ProcessingPhase

	IntentType string

	ExtractedEntities map[string]interface{}

	TelecomContext map[string]interface{}

	ResourcePlan *ResourcePlan

	Manifests map[string]string

	GitCommitHash string

	DeploymentStatus map[string]interface{}

	Metrics map[string]float64
}

type ProcessingPhase

type ProcessingPhase string
const (
	PhaseLLMProcessing ProcessingPhase = "LLMProcessing"

	PhaseResourcePlanning ProcessingPhase = "ResourcePlanning"

	PhaseManifestGeneration ProcessingPhase = "ManifestGeneration"

	PhaseGitOpsCommit ProcessingPhase = "GitOpsCommit"

	PhaseDeploymentVerification ProcessingPhase = "DeploymentVerification"
)

type QoSSpec

type QoSSpec struct {
	Bandwidth string `json:"bandwidth"`

	Latency string `json:"latency"`

	Jitter string `json:"jitter"`

	PacketLoss float64 `json:"packet_loss"`
}

type RANFunctionConfig

type RANFunctionConfig struct {
	FunctionID int32 `json:"functionId"`

	Revision int32 `json:"revision"`

	Description string `json:"description"`

	OID string `json:"oid"`
}

type Reconciler

type Reconciler struct {
	*NetworkIntentReconciler
	// contains filtered or unexported fields
}

func NewReconciler

func NewReconciler(r *NetworkIntentReconciler) *Reconciler

func (*Reconciler) ExecuteProcessingPipeline

func (r *Reconciler) ExecuteProcessingPipeline(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*Reconciler) IsProcessingComplete

func (r *Reconciler) IsProcessingComplete(networkIntent *nephoranv1.NetworkIntent) bool

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

type ReconcilerInterface

type ReconcilerInterface interface {
	Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

	ExecuteProcessingPipeline(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	IsProcessingComplete(networkIntent *nephoranv1.NetworkIntent) bool
}

type ResourcePlan

type ResourcePlan struct {
	NetworkFunctions []PlannedNetworkFunction `json:"network_functions"`

	ResourceRequirements ResourceRequirements `json:"resource_requirements"`

	DeploymentPattern string `json:"deployment_pattern"`

	QoSProfile string `json:"qos_profile"`

	SliceConfiguration *SliceConfiguration `json:"slice_configuration,omitempty"`

	Interfaces []InterfaceConfiguration `json:"interfaces"`

	SecurityPolicies []SecurityPolicy `json:"security_policies"`

	EstimatedCost float64 `json:"estimated_cost"`
}

type ResourcePlanner

type ResourcePlanner struct {
	*NetworkIntentReconciler
}

func NewResourcePlanner

func NewResourcePlanner(r *NetworkIntentReconciler) *ResourcePlanner

func (*ResourcePlanner) CalculateEstimatedCost

func (p *ResourcePlanner) CalculateEstimatedCost(plan *ResourcePlan) (float64, error)

func (*ResourcePlanner) GenerateManifests

func (p *ResourcePlanner) GenerateManifests(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*ResourcePlanner) GetPhaseName

func (p *ResourcePlanner) GetPhaseName() ProcessingPhase

func (*ResourcePlanner) IsPhaseComplete

func (p *ResourcePlanner) IsPhaseComplete(networkIntent *nephoranv1.NetworkIntent) bool

func (*ResourcePlanner) PlanNetworkFunction

func (p *ResourcePlanner) PlanNetworkFunction(nfName string, llmParams, telecomContext map[string]interface{}) (*PlannedNetworkFunction, error)

func (*ResourcePlanner) PlanResources

func (p *ResourcePlanner) PlanResources(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

func (*ResourcePlanner) ProcessPhase

func (p *ResourcePlanner) ProcessPhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

type ResourcePlannerInterface

type ResourcePlannerInterface interface {
	PhaseProcessor

	PlanResources(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	GenerateManifests(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, processingCtx *ProcessingContext) (ctrl.Result, error)

	PlanNetworkFunction(nfName string, llmParams, telecomContext map[string]interface{}) (*PlannedNetworkFunction, error)

	CalculateEstimatedCost(plan *ResourcePlan) (float64, error)
}

type ResourceRequirements

type ResourceRequirements struct {
	CPU string `json:"cpu"`

	Memory string `json:"memory"`

	Storage string `json:"storage"`

	NetworkBW string `json:"network_bandwidth"`

	GPU string `json:"gpu,omitempty"`

	Accelerator string `json:"accelerator,omitempty"`
}

type RetryManagerInterface

type RetryManagerInterface interface {
	GetRetryCount(networkIntent *nephoranv1.NetworkIntent, operation string) int

	SetRetryCount(networkIntent *nephoranv1.NetworkIntent, operation string, count int)

	ClearRetryCount(networkIntent *nephoranv1.NetworkIntent, operation string)

	IsRetryLimitExceeded(networkIntent *nephoranv1.NetworkIntent, operation string, maxRetries int) bool

	CalculateBackoffDelay(retryCount int, operation string) ctrl.Result
}

type SecurityManagerInterface

type SecurityManagerInterface interface {
	SanitizeInput(ctx context.Context, input string) (string, error)

	ValidateOutput(ctx context.Context, output string) (string, error)

	BuildSecurePrompt(systemPrompt, userPrompt string) string
}

type SecurityPolicy

type SecurityPolicy struct {
	Name string `json:"name"`

	Type string `json:"type"`

	Config json.RawMessage `json:"config"`
}

type SecuritySpec

type SecuritySpec struct {
	Authentication string `json:"authentication"`

	Encryption string `json:"encryption"`
}

type SimulationConfigData

type SimulationConfigData struct {
	UECount int32 `json:"ueCount"`

	TrafficGeneration bool `json:"trafficGeneration"`

	MetricsInterval string `json:"metricsInterval"`

	TrafficProfile string `json:"trafficProfile"`
}

type SliceConfiguration

type SliceConfiguration struct {
	SliceType string `json:"slice_type"`

	SST int `json:"sst"`

	SD string `json:"sd,omitempty"`

	QoSProfile string `json:"qos_profile"`

	Isolation string `json:"isolation"`

	Parameters json.RawMessage `json:"parameters"`
}

type StatusManagerInterface

type StatusManagerInterface interface {
	UpdatePhase(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, phase string) error

	SetReadyCondition(ctx context.Context, networkIntent *nephoranv1.NetworkIntent, status, reason, message string) error

	UpdateCondition(networkIntent *nephoranv1.NetworkIntent, conditionType, status, reason, message string)

	IsConditionTrue(networkIntent *nephoranv1.NetworkIntent, conditionType string) bool
}

type StructuredIntent

type StructuredIntent struct {
	Type string `json:"type"`

	Data json.RawMessage `json:"data"`
}

type ValidationError

type ValidationError struct {
	Field string

	Value interface{}

	Message string
}

func NewValidationError

func NewValidationError(field string, value interface{}, message string) *ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

type ValidationInterface

type ValidationInterface interface {
	ValidateNetworkIntent(networkIntent *nephoranv1.NetworkIntent) error

	ValidateProcessingContext(processingCtx *ProcessingContext) error

	ValidateResourcePlan(plan *ResourcePlan) error

	ValidateConfiguration(config *Config) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL