New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UE ip pool allocation by UPF #203
UE ip pool allocation by UPF #203
Conversation
edf1f60
to
e6c0bf4
Compare
pfcpiface/ip_pool.go
Outdated
@@ -0,0 +1,55 @@ | |||
// SPDX-License-Identifier: Apache-2.0 | |||
// Copyright(c) 2020 Intel Corporation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add ONF copyright header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pfcpiface/session-pdr.go
Outdated
if (pdr.allocIpFlag) && (pdr.srcIface == core) { | ||
log.Println("pdrID : ", pdr.pdrID) | ||
var ueIP net.IP = int2ip(pdr.dstIP) | ||
log.Println("ueIP : ", ueIP.String()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clubbing 2 logs would help.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
func has2ndBit(f uint8) bool { | ||
return (f&0x02)>>1 == 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if bool return is not required then we can avoid >> 1 & == 1 check.
return (f & 0x02)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we would have to add check for ==1 wherever we call has2ndBit. So will let it be as it is for now.
In general changes look good. |
@badhrinathpa @thakurajayL what do you think of using something like this for IPAM? |
pfcpiface/bess.go
Outdated
@@ -278,6 +278,12 @@ func (b *bess) setUpfInfo(u *upf, conf *Conf) { | |||
u.simInfo = simInfo | |||
} | |||
|
|||
u.ippool_cidr = conf.CPIface.UeIPPool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change all naming to not have underscore. I thought one of the linting tool checks and throws warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pfcpiface/main.go
Outdated
DestIP string `json:"nb_dst_ip"` | ||
SrcIP string `json:"nb_src_ip"` | ||
FQDNHost string `json:"hostname"` | ||
EnableUeIPAlloc bool `json:"enable_ue_ip_alloc"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep this before UE IP pool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pfcpiface/ip_pool.go
Outdated
func needAllocIp(ueIPaddr *ie.UEIPAddressFields) bool { | ||
if has2ndBit(ueIPaddr.Flags) && !has5thBit(ueIPaddr.Flags) { | ||
return false | ||
} | ||
return true | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to parse-pdr.go itself? that way this file will purely be IP allocation related.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -212,7 +227,7 @@ func (p *pdr) parsePDI(pdiIEs []*ie.IE, appPFDs map[string]appPFD) error { | |||
return nil | |||
} | |||
|
|||
func (p *pdr) parsePDR(ie1 *ie.IE, seid uint64, appPFDs map[string]appPFD) error { | |||
func (p *pdr) parsePDR(ie1 *ie.IE, seid uint64, appPFDs map[string]appPFD, upf *upf) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to pass entire UPF object or just ip_pool struct is enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its just pointer passing. might need other values later. So keeping as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking in terms layer/scope instead pointer or not.
e6c0bf4
to
f228811
Compare
f228811
to
132ae64
Compare
retest this please |
Changes include :